{"id":43869,"library":"sqigil","title":"SQigiL","description":"SQigiL is an ESM-only Postgres SQL template string library (v0.4.0) that leverages ES2015 tagged template literals for safe, fast SQL construction without runtime parsing overhead. It provides auto-escaping for values, booleans, dates, identifiers, lists, and raw SQL, with full TypeScript types and 100% test coverage. Unlike pg-promise, it avoids string parsing overhead. Current status: maintenance – still in early stages (beta), with infrequent releases.","status":"maintenance","version":"0.4.0","language":"javascript","source_language":"en","source_url":"https://github.com/twooster/sqigil","tags":["javascript","sql","postgres","template","format","escape","string","typescript"],"install":[{"cmd":"npm install sqigil","lang":"bash","label":"npm"},{"cmd":"yarn add sqigil","lang":"bash","label":"yarn"},{"cmd":"pnpm add sqigil","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package is ESM-only and ships TypeScript types; default export is a tagged template function.","wrong":"const sql = require('sqigil');","symbol":"sql","correct":"import { sql } from 'sqigil';"},{"note":"sql is the default export; value is a sub-method. Cannot import directly as value.","wrong":"import { sql } from 'sqigil'; sql`...${value('text')}...`;","symbol":"sql.value","correct":"import { sql } from 'sqigil'; sql`...${sql.value('text')}...`;"},{"note":"csv is only accessible as a method on the sql tagged template function.","wrong":"import { sql, csv } from 'sqigil';","symbol":"sql.csv","correct":"import { sql } from 'sqigil'; sql`...${sql.csv([1,2,3])}...`;"},{"note":"id is a sub-method of sql, not a standalone export.","wrong":"import { sqlId } from 'sqigil';","symbol":"sql.id","correct":"import { sql } from 'sqigil'; sql`...${sql.id('table_name')}...`;"}],"quickstart":{"code":"import { sql } from 'sqigil';\n\nconst name = \"O'Connor\";\nconst ids = [1, 2, 3];\nconst active = true;\n\nconst query = sql`\n  SELECT * FROM users\n  WHERE name = ${name}\n    AND id IN (${sql.csv(ids)})\n    AND active = ${sql.bool(active)}\n`;\n\nconsole.log(query);\n// SELECT * FROM users WHERE name = 'O''Connor' AND id IN (1, 2, 3) AND active = TRUE\n\n// Also supports identifiers, raw SQL, dates, etc.\nconst table = 'users';\nconst columns = ['name', 'email'];\nconst insertQuery = sql`\n  INSERT INTO ${sql.id(table)} (${sql.csids(columns)})\n  VALUES (${sql.values({ name: 'John', email: 'john@example.com' })})\n`;\nconsole.log(insertQuery);\n// INSERT INTO \"users\" (\"name\", \"email\") VALUES ('John', 'john@example.com')","lang":"typescript","description":"Demonstrates basic sql tagged template usage with automatic escaping, csv list, bool conversion, identifier quoting, and dynamic column insertion."},"warnings":[{"fix":"Ensure only strings, numbers, booleans, null, undefined, arrays, Dates, Buffers, or objects are passed as template expressions.","message":"Using Symbols or Functions as values will throw an error at runtime.","severity":"gotcha","affected_versions":">=0.4.0"},{"fix":"Use sql.csv() for simple lists instead of relying on default array conversion, or wrap with sql.value() explicitly.","message":"Arrays are converted to Postgres array literal format; nested arrays work but may produce unexpected SQL.","severity":"gotcha","affected_versions":">=0.4.0"},{"fix":"Consistently use either default Date conversion (UTC) or sql.utc()/sql.tz() for explicit timezone handling.","message":"Date objects are converted to ISO 8601 in UTC; using sql.tz() outputs local timezone; mixing can cause inconsistencies.","severity":"gotcha","affected_versions":">=0.4.0"},{"fix":"Use import { sql } from 'sqigil'; or configure bundler/tester to handle ESM.","message":"The library is ESM-only; CommonJS require() will fail with Module not found.","severity":"breaking","affected_versions":">=0.4.0"}],"env_vars":null,"search_vec":"'100':48 'auto':32 'auto-escap':31 'avoid':56 'beta':67 'boolean':36 'construct':24 'coverag':50 'current':60 'date':37 'earli':65 'es2015':16 'escap':33,76 'esm':6 'esm-on':5 'fast':22 'format':75 'full':44 'identifi':38 'infrequ':69 'javascript':71 'leverag':15 'librari':12 'list':39 'liter':19 'mainten':62 'overhead':28,59 'pars':27,58 'pg':53 'pg-promis':52 'postgr':8,73 'promis':54 'provid':30 'raw':41 'releas':70 'runtim':26 'safe':21 'sqigil':1,2 'sql':9,23,42,72 'stage':66 'status':61 'still':63 'string':11,57,77 'tag':17 'templat':10,18,74 'test':49 'type':46 'typescript':45,78 'unlik':51 'v0.4.0':13 'valu':35 'without':25","created_at":"2026-06-05T17:01:52.178829+00:00","updated_at":"2026-06-05T17:01:52.178829+00:00","problems":[{"fix":"Do not use Symbol values inside sql tagged templates.","cause":"Passing a Symbol as a template expression.","error":"Error: Symbols are not supported as SQL values"},{"fix":"Switch to import syntax or use dynamic import(): const { sql } = await import('sqigil');","cause":"Using CommonJS require() to import the ESM-only package.","error":"TypeError: require() of ES Module sqigil not supported"},{"fix":"Use import { sql } from 'sqigil'; (named export).","cause":"Incorrectly imported sql as a default export but tried to use as named (e.g., import sql from 'sqigil') or vice versa.","error":"TypeError: sql(...) is not a function"}],"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/twooster/sqigil#readme","github":"https://github.com/twooster/sqigil","docs":null,"changelog":null,"pypi":null,"npm":"sqigil","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}}