{"id":21893786,"url":"https://github.com/goodwaygroup/redshift-ddl","last_synced_at":"2026-05-07T01:34:37.103Z","repository":{"id":35685791,"uuid":"218914769","full_name":"GoodwayGroup/redshift-ddl","owner":"GoodwayGroup","description":"Utility to inspect an Amazon Redshift database DDL","archived":false,"fork":false,"pushed_at":"2023-01-05T00:39:39.000Z","size":314,"stargazers_count":0,"open_issues_count":14,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-29T08:00:24.120Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GoodwayGroup.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-01T04:45:36.000Z","updated_at":"2019-11-07T01:30:53.000Z","dependencies_parsed_at":"2023-01-16T03:04:43.267Z","dependency_job_id":null,"html_url":"https://github.com/GoodwayGroup/redshift-ddl","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoodwayGroup%2Fredshift-ddl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoodwayGroup%2Fredshift-ddl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoodwayGroup%2Fredshift-ddl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoodwayGroup%2Fredshift-ddl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GoodwayGroup","download_url":"https://codeload.github.com/GoodwayGroup/redshift-ddl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244902918,"owners_count":20529114,"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":[],"created_at":"2024-11-28T13:16:55.135Z","updated_at":"2026-05-07T01:34:37.073Z","avatar_url":"https://github.com/GoodwayGroup.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @goodwaygroup/redshift-ddl\n\n\u003c!--[![CircleCI](https://circleci.com/gh/GoodwayGroup/redshift-ddl.svg?style=svg)](https://circleci.com/gh/GoodwayGroup/redshift-ddl)--\u003e\n\nThis module will query a Amazon Redshift database to produce information about it's DDL.\n\n## CLI Usage\n\n```bash\n$ redshift-ddl load \u003e /tmp/ddl.json\n\n$ redshift-ddl load --connection-string=postgres://localhost:5439/thedb \u003e /tmp/ddl.json\n\n$ PGCONNECTIONSTRING=postgres://localhost:5439/thedb redshift-ddl load \u003e /tmp/ddl.json\n```\n\n### CLI Help\n```bash\n$ redshift-ddl --help\nUsage: redshift-ddl [options] [command]\n\nOptions:\n  -V, --version   output the version number\n  -v, --verbose   verbose debug output\n  -h, --help      output usage information\n\nCommands:\n  load [options]  load the ddl\n\n$ redshift-ddl load --help\nUsage: redshift-ddl load [options]\n\nload the ddl\n\nOptions:\n  -c, --connection-string \u003cconnection\u003e  connection string, defaults to PGCONNECTIONSTRING\n  -h, --help                            output usage information\n```\n\n## Library Usage\n\n```js\nconst { loadDDL, processDDL } = require('@goodwaygroup/redshift-ddl');\n\nconst loadedDDL = await loadDDL();\nconst processedDDL = await processDDL(loadedDDL);\n\nconsole.log(processedDDL);\n```\n\n## Configuration Options\n\nThis module uses [pg](https://www.npmjs.com/package/pg) and by default you can use the environment variables it reads to config how the connection is made to Redshift.\n\n### Connection Environment Variables\n\n```\n# Redshift connection information\nPGHOST=localhost\nPGUSER=process.env.USER\nPGDATABASE=process.env.USER\nPGPASSWORD=null\nPGPORT=5439\n\n# Redshift connection string (preferred if defined)\nPGCONNECTIONSTRING=postgresql://dbuser:secretpassword@database.server.com:5439/mydb\n```\n\n### Existing Connection\n\nIf you already have a `pg.Pool` or `pg.Client` created, you can pass that to `loadDDL`.\n\n```js\nconst ddl = await loadDDL({ conn: alreadyExistingConn });\n```\n\n### Make a new Connection with Explicit Configuration\n\nThis module exposes convenience methods to create instances of either `pg.Pool` or `pg.Client`.\n\n```js\nconst { createClient, createPool } = require('@goodwaygroup/redshift-ddl');\n\n// Client\nconst connClient = createClient({\n    options: {\n        statement_timeout: 15000\n    }\n});\n\n// Pool\nconst connPool = createClient({\n    options: {\n        statement_timeout: 15000,\n        connectionTimeoutMillis: 1000,\n        max: 4\n    }\n});\n```\n\n#### Docs\n* [`pg.Client`](https://node-postgres.com/api/client)\n* [`pg.Pool`](https://node-postgres.com/api/pool)\n\n## Processed DDL\n\nUsing `processDDL` with the result to `loadDDL` will produce a single object organized by schema. Each schema will contain all of it's tables, views, udfs, and external tables. This is the object returned by the command line tool from this module.\n\n## Running Tests\n\nTo run tests, just run the following:\n\n```\nnpm test\n```\n\nAll commits are tested on [CircleCI](https://circleci.com/gh/GoodwayGroup/workflows/redshift-ddl)\n\n## Linting\n\nTo run `eslint`:\n\n```\nnpm run lint\n```\n\nTo auto-resolve:\n\n```\nnpm run lint:fix\n```\n\n## Contributing\n\nPlease read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.\n\n## Versioning\n\nWe use milestones and `npm` version to bump versions. We also employ [auto-changelog](https://www.npmjs.com/package/auto-changelog) to manage the [CHANGELOG.md](CHANGELOG.md). For the versions available, see the [tags on this repository](https://github.com/GoodwayGroup/redshift-ddl/tags).\n\nTo initiate a version change:\n\n```\nnpm version\n```\n\n## Authors\n\n* **Julian Lannigan** - *Initial work* - [@mrlannigan](https://github.com/mrlannigan)\n\nSee also the list of [contributors](https://github.com/GoodwayGroup/redshift-ddl/contributors) who participated in this project.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details\n\n## Sponsors\n\n[![goodwaygroup][goodwaygroup]](https://goodwaygroup.com)\n\n[goodwaygroup]: https://s3.amazonaws.com/gw-crs-assets/goodwaygroup/logos/ggLogo_sm.png \"Goodway Group\"","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoodwaygroup%2Fredshift-ddl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoodwaygroup%2Fredshift-ddl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoodwaygroup%2Fredshift-ddl/lists"}