{"id":44173,"library":"zol","title":"Zol","description":"A type-safe SQL abstraction layer for TypeScript and PostgreSQL, inspired by Selda and LINQ. Current stable version 0.5.1 is pre-1.0 with breaking changes expected. Offers composable query building with compile-time type safety, contrasting with runtime ORMs. Requires pg driver. Ships TypeScript definitions.","status":"active","version":"0.5.1","language":"javascript","source_language":"en","source_url":"https://github.com/MedFlyt/zol","tags":["javascript","typescript","sql","query","postgresql","postgres","orm"],"install":[{"cmd":"npm install zol","lang":"bash","label":"npm"},{"cmd":"yarn add zol","lang":"bash","label":"yarn"},{"cmd":"pnpm add zol","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Runtime PostgreSQL driver – peer dependency >=8 <9","package":"pg","optional":false}],"imports":[{"note":"ESM-only package; named import.","wrong":"const zol = require('zol')","symbol":"zol","correct":"import { zol } from 'zol'"},{"note":"Named export for defining table schemas.","wrong":"","symbol":"Table","correct":"import { Table } from 'zol'"},{"note":"query is a separate named export, not a method on zol.","wrong":"import { zol } from 'zol'; zol.query(...)","symbol":"query","correct":"import { query } from 'zol'"},{"note":"Used for composing SELECT queries.","wrong":"","symbol":"select","correct":"import { select } from 'zol'"},{"note":"For INSERT statements.","wrong":"","symbol":"insert","correct":"import { insert } from 'zol'"}],"quickstart":{"code":"import { zol, Table, query, select, insert, text, integer, serial } from 'zol'\nimport { Pool } from 'pg'\n\nconst pool = new Pool({ connectionString: process.env.DATABASE_URL ?? '' })\n\nconst users = new Table('users', {\n  id: serial(),\n  name: text(),\n  age: integer()\n})\n\nconst getUsersOverAge = (age: number) =>\n  query(select(users.id, users.name, users.age))\n    .from(users)\n    .where(users.age.gt(age))\n    .orderBy(users.name)\n\nasync function run() {\n  const client = await pool.connect()\n  try {\n    const rows = await getUsersOverAge(18).execute(client)\n    console.log(rows)\n  } finally {\n    client.release()\n  }\n}\nrun().catch(console.error)","lang":"typescript","description":"Shows table definition, query composition with typed columns, and execution with pg Pool."},"warnings":[{"fix":"Pin exact version (e.g., \"zol\": \"0.5.1\") and review changelog before upgrading.","message":"Pre-1.0 releases may introduce breaking changes without major version bump.","severity":"breaking","affected_versions":"<1.0.0"},{"fix":"Call pool.connect() to obtain a client, then pass it to .execute().","message":"Query execution requires a pg client (not a pool) directly – the .execute() method expects a Client, not Pool.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Ensure column definitions match the actual database schema exactly.","message":"Table columns are typed using the provided row schema; mismatched column names cause compile-time errors.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use a migration tool (e.g., node-pg-migrate) to manage schema separately.","message":"The package does not create tables or migrations; it assumes the schema exists in the database.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'-1.0':24 '0.5.1':21 'abstract':7 'break':26 'build':32 'chang':27 'compil':35 'compile-tim':34 'compos':30 'contrast':39 'current':18 'definit':48 'driver':45 'expect':28 'inspir':13 'javascript':49 'layer':8 'linq':17 'offer':29 'orm':42,55 'pg':44 'postgr':54 'postgresql':12,53 'pre':23 'queri':31,52 'requir':43 'runtim':41 'safe':5 'safeti':38 'selda':15 'ship':46 'sql':6,51 'stabl':19 'time':36 'type':4,37 'type-saf':3 'typescript':10,47,50 'version':20 'zol':1","created_at":"2026-06-05T17:03:19.527838+00:00","updated_at":"2026-06-05T17:03:19.527838+00:00","problems":[{"fix":"import { query } from 'zol'","cause":"Incorrect import – using zol.query instead of named import 'query'.","error":"TypeError: (0 , zol_1.query) is not a function"},{"fix":"npm install pg @types/pg","cause":"Missing peer dependency pg or its types.","error":"Cannot find module 'pg' or its corresponding type declarations."},{"fix":"Ensure you are using zol >=0.5.0 and chain .execute(client) on the query.","cause":"Forgetting to call .query()? Actually execute is on the result of query(select(...)). Confirm version; early versions may not have execute.","error":"Property 'execute' does not exist on type 'QueryBuilder'."},{"fix":"Use zol types: import { text, integer, serial } from 'zol' and define columns with those functions.","cause":"Using string instead of zol's column type definitions (text(), integer(), etc.).","error":"Type 'string' is not assignable to type 'SqlType'."}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/MedFlyt/zol#readme","github":"https://github.com/MedFlyt/zol","docs":null,"changelog":null,"pypi":null,"npm":"zol","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-05","next_check":"2026-09-03","install_tag":null}}