AutoSQL is a TypeScript-powered zero-config ingestion library that automatically infers SQL schemas from JSON data and inserts it into MySQL or PostgreSQL. Version 1.1.1 supports automatic schema creation, alteration, batch inserts, and streaming with minimal configuration. It differs from traditional ORMs by requiring no model definitions or migration scripts, making it suitable for rapidly evolving data pipelines. Key features include type inference, primary key management, schema drift detection, and SSH tunneling support. The library is actively maintained, with the latest release focusing on stability and MySQL compatibility.
npm install autosqlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Connects to a MySQL database, infers schema from JSON data, creates or alters the 'users' table, and inserts the data batch-wise using autoSQL.
Ensure metaData object keys match table names and values conform to MetadataHeader interface (see docs).
Always use Database.create(config) to instantiate, then call .establishConnection().
Replace autoInsertData({ table, data, insertOptions }) with autoSQL(table, data) and set options in DatabaseConfig.Set sqlDialect: 'pgsql' for PostgreSQL, not 'postgres'.
Manually truncate the table before running autoSQL if you need a fresh insert, or use a separate migration step.
Replace 'new Database(config)' with 'Database.create(config)'.
Run 'npm install mysql2' to install the MySQL driver.
Set 'sqlDialect: 'pgsql'' in configuration.