{"id":42865,"library":"imago-sql","title":"Imago SQL","description":"Small library to work with Azure SQL and MySQL via a single interface. Based on the mssql module. Current stable version is 4.8.0. Released under MIT license. Key differentiator: provides a unified API for Azure SQL and MySQL, with connection pooling and parameterized queries. Well-suited for projects requiring both database engines without changing code. Relies on mssql for Azure SQL and mysql2 for MySQL.","status":"active","version":"4.8.0","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","imago.ai","imago","sql"],"install":[{"cmd":"npm install imago-sql","lang":"bash","label":"npm"},{"cmd":"yarn add imago-sql","lang":"bash","label":"yarn"},{"cmd":"pnpm add imago-sql","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Azure SQL driver","package":"mssql","optional":false},{"reason":"MySQL driver","package":"mysql2","optional":true}],"imports":[{"note":"CommonJS only; no ESM. Use require.","wrong":"import Sql from 'imago-sql';","symbol":"Sql","correct":"const Sql = require('imago-sql');"},{"note":"Do not require mssql separately; use the internal instance to avoid duplicate driver errors.","wrong":"require('mssql').NVarChar","symbol":"sql.db.mssql","correct":"sql.db.mssql.NVarChar"},{"note":"Constructor expects a string connection URL, not an object.","wrong":"new Sql({ connectionString: '...' })","symbol":"new Sql(connectionString, options)","correct":"let sql = new Sql('mssql://...');"}],"quickstart":{"code":"const Sql = require('imago-sql');\n\nasync function main() {\n  const sql = new Sql(process.env.DB_CONNECTION_STRING ?? '');\n  await sql.connection; // ensure connection\n  const results = await sql.selectAll('My_Table_Name');\n  console.log(results);\n}\n\nmain().catch(console.error);","lang":"javascript","description":"Connects to Azure SQL using connection string and fetches all rows from a table."},"warnings":[{"fix":"Use sql.db.mssql for column types.","message":"Do not require mssql separately; it causes duplicate driver errors.","severity":"gotcha","affected_versions":">=1.0"},{"fix":"Use await sql.connection before any query.","message":"Connection object is async; must await sql.connection before queries.","severity":"gotcha","affected_versions":">=1.0"},{"fix":"Update to Node.js >= 8.9 or use lower version if needed.","message":"Minimum Node.js version is 8.9 as of latest version.","severity":"deprecated","affected_versions":">=4.0"},{"fix":"Pass { engine: 'mysql' } as second argument to constructor.","message":"MySQL engine requires engine: 'mysql' option","severity":"gotcha","affected_versions":">=1.0"}],"env_vars":null,"search_vec":"'4.8.0':25 'api':35 'azur':8,37,63 'base':16 'chang':57 'code':58 'connect':42 'current':21 'databas':54 'differenti':31 'engin':55 'imago':1,71 'imago.ai':70 'interfac':15 'javascript':69 'key':30 'librari':4 'licens':29 'mit':28 'modul':20 'mssql':19,61 'mysql':11,40,68 'mysql2':66 'parameter':45 'pool':43 'project':51 'provid':32 'queri':46 'releas':26 'reli':59 'requir':52 'singl':14 'small':3 'sql':2,9,38,64,72 'stabl':22 'suit':49 'unifi':34 'version':23 'via':12 'well':48 'well-suit':47 'without':56 'work':6","created_at":"2026-06-05T16:57:02.502008+00:00","updated_at":"2026-06-05T16:57:02.502008+00:00","problems":[{"fix":"Ensure sql is declared and accessible in the function.","cause":"sql variable not in scope","error":"ReferenceError: sql is not defined"},{"fix":"Run npm install imago-sql --save","cause":"Package not installed","error":"Cannot find module 'imago-sql'"},{"fix":"Use await sql.connection","cause":"sql.connection not awaited","error":"TypeError: sql.connection.then 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://bitbucket.org/imagoai/imago-sql#readme","github":null,"docs":null,"changelog":null,"pypi":null,"npm":"imago-sql","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}}