{"id":19388525,"url":"https://github.com/thinkthinkai/dbinfoz","last_synced_at":"2026-02-12T04:14:19.690Z","repository":{"id":222230097,"uuid":"756662411","full_name":"ThinkThinkAI/dbinfoz","owner":"ThinkThinkAI","description":"NPM Get Database Info and Table Schemas","archived":false,"fork":false,"pushed_at":"2024-10-23T23:45:15.000Z","size":6362,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-24T08:56:27.655Z","etag":null,"topics":["mysql","npm","npm-package","postgresql","sql","sqlite3"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ThinkThinkAI.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-13T03:52:01.000Z","updated_at":"2024-10-23T23:45:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"2e640cad-244b-4078-952f-1fddcf691393","html_url":"https://github.com/ThinkThinkAI/dbinfoz","commit_stats":null,"previous_names":["rootedbox/dbinfo","rootedbox/dbinfoz"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThinkThinkAI%2Fdbinfoz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThinkThinkAI%2Fdbinfoz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThinkThinkAI%2Fdbinfoz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThinkThinkAI%2Fdbinfoz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ThinkThinkAI","download_url":"https://codeload.github.com/ThinkThinkAI/dbinfoz/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250532073,"owners_count":21446110,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mysql","npm","npm-package","postgresql","sql","sqlite3"],"created_at":"2024-11-10T10:12:53.181Z","updated_at":"2026-02-12T04:14:14.646Z","avatar_url":"https://github.com/ThinkThinkAI.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🌐 DBINFOZ Universal Database Adapter\n\nA simple and unified interface to interact with different types of SQL databases including PostgreSQL, MySQL, MSSQL, and SQLite.\n\n## ✨ Features\n\n- 📚 List all databases\n- 📃 List all tables within a database\n- 📄 Get the schema of a table\n- 🗂 Get all tables and their schemas within a database\n\nSupports PostgreSQL, MySQL, MSSQL, and SQLite databases.\n\n## 🛠 Installation\n\n```bash\nnpm install dbinfoz\n```\n\n## 🚀 Usage\n\nFirst, require the package and use the factory function to get an instance of the database adapter based on the type of database you're working with:\n\n```javascript\nconst getDatabaseAdapter = require('dbinfo');\n\n// For PostgreSQL\nconst postgresConfig = {\n  user: 'yourUsername',\n  host: 'localhost',\n  database: 'yourDatabase',\n  password: 'yourPassword',\n  port: 5432,\n};\nconst postgresAdapter = getDatabaseAdapter('postgres', postgresConfig);\n\n// For MySQL\nconst mysqlConfig = {\n  host: 'localhost',\n  user: 'yourUsername',\n  database: 'yourDatabase',\n  password: 'yourPassword',\n  port: 3306,\n};\nconst mysqlAdapter = getDatabaseAdapter('mysql', mysqlConfig);\n\n// For MSSQL\nconst mssqlConfig = {\n  server: 'localhost',\n  user: 'yourUsername',\n  database: 'yourDatabase',\n  password: 'yourPassword',\n  port: 1433,\n};\nconst mssqlAdapter = getDatabaseAdapter('mssql', mssqlConfig);\n\n// For SQLite\nconst sqliteConfig = {\n  filename: './path/to/database.sqlite',\n};\nconst sqliteAdapter = getDatabaseAdapter('sqlite', sqliteConfig);\n```\n\n## 📖 Examples\n\n```javascript\nconst getDatabaseAdapter = require('./index');\n\n// Configuration for the required database\nconst config = {\n  host: 'localhost', // For MySQL and PostgreSQL\n  user: 'root', // For MySQL\n  password: 'password', // For MySQL and PostgreSQL\n  database: 'mydb',\n  filename: './mydb.sqlite' // For SQLite\n};\n\n// Specify the database type ('sqlite', 'mysql', 'postgres')\nconst type = 'sqlite'; // Change as needed\n\n(async () =\u003e {\n  try {\n    const dbAdapter = getDatabaseAdapter(type, config);\n\n    // List databases\n    const databases = await dbAdapter.listDatabases();\n    console.log('Databases:', databases);\n\n    // List tables\n    const tables = await dbAdapter.listTables();\n    console.log('Tables:', tables);\n\n    // Get table schema\n    const schema = await dbAdapter.getTableSchema('my_table');\n    console.log('Schema:', schema);\n\n    // Run a custom query\n    const result = await dbAdapter.runQuery('SELECT * FROM my_table');\n    console.log('Query Result:', result);\n\n    // Close the connection (SQLite specific method for example purposes)\n    if (dbAdapter.close) {\n      await dbAdapter.close();\n    }\n  } catch (error) {\n    console.error('Error:', error.message);\n  }\n})();\n```\n\n## 💡 Contributing\n\nContributions, issues, and feature requests are welcome! Feel free to check [issues page](https://github.com/rootedbox/dbinfoz/issues).\n\n## 📝 License\n\n[MIT](https://github.com/rootedbox/dbinfoz/blob/main/LICENSE) © Jason Jacobs\n\n## 📁 Repository\n\nThe source code is available at [GitHub](https://github.com/rootedbox/dbinfoz).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinkthinkai%2Fdbinfoz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthinkthinkai%2Fdbinfoz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinkthinkai%2Fdbinfoz/lists"}