{"id":19595310,"url":"https://github.com/yaroslavkrutiak/databricks-sql-cli","last_synced_at":"2025-08-03T06:08:57.158Z","repository":{"id":255179438,"uuid":"848794262","full_name":"yaroslavkrutiak/databricks-sql-cli","owner":"yaroslavkrutiak","description":"Helper CLI to apply migrations to a databricks sql warehouse","archived":false,"fork":false,"pushed_at":"2024-08-29T14:17:13.000Z","size":131,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-17T10:47:17.545Z","etag":null,"topics":["cli","databricks","delta-lake","migration","nodejs","sql"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/databricks-sql-cli","language":"TypeScript","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/yaroslavkrutiak.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2024-08-28T12:22:32.000Z","updated_at":"2024-08-29T23:32:11.000Z","dependencies_parsed_at":"2024-08-28T13:24:10.770Z","dependency_job_id":"100b8d96-fb66-4c35-afdb-eb5bcb6f2965","html_url":"https://github.com/yaroslavkrutiak/databricks-sql-cli","commit_stats":null,"previous_names":["yaroslavkrutiak/databricks-sql-cli"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/yaroslavkrutiak/databricks-sql-cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yaroslavkrutiak%2Fdatabricks-sql-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yaroslavkrutiak%2Fdatabricks-sql-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yaroslavkrutiak%2Fdatabricks-sql-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yaroslavkrutiak%2Fdatabricks-sql-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yaroslavkrutiak","download_url":"https://codeload.github.com/yaroslavkrutiak/databricks-sql-cli/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yaroslavkrutiak%2Fdatabricks-sql-cli/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268500608,"owners_count":24260163,"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","status":"online","status_checked_at":"2025-08-03T02:00:12.545Z","response_time":2577,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cli","databricks","delta-lake","migration","nodejs","sql"],"created_at":"2024-11-11T08:46:30.378Z","updated_at":"2025-08-03T06:08:57.111Z","avatar_url":"https://github.com/yaroslavkrutiak.png","language":"TypeScript","readme":"# databricks-sql-cli\n\nHelper CLI to apply migrations to a databricks sql warehouse\n\n**Overview:**\n\nThis tool simplifies the process of creating and applying SQL migrations for your Databricks tables. It manages migration versions, ensuring a smooth and predictable workflow when evolving your data schema.\n\n**Installation:**\nThe `databricks-sql-cli` tool is assumed to be installed and accessible globally through npm or yarn. You can install it using the following commands:\n\n```sh\nnpm i --save-dev databricks-sql-cli\n```\n\n```sh\nyarn add databricks-sql-cli --dev\n```\n\n**Usage:**\n\nThe tool is invoked using the following syntax:\n\n```\ndbsql \u003ccommand\u003e [options]\n```\n\n**Available Commands:**\n\n- **init:** Initializes the migration environment by creating a dedicated folder for migration files and a table to track migration versions.\n- **create:** Generates a new SQL migration file with a timestamped filename. You can optionally specify a custom name using the `-n` flag.\n- **apply:** Applies all unapplied migrations in ascending order based on their version numbers.\n- **reset:** Drops the schema and then reapplies all migrations from scratch.\n\n**Options:**\n\n- `-h, --host`: Specifies the hostname of your Databricks workspace. (Optional)\n- `-p, --path`: Defines the path to your Databricks workspace directory. (Optional)\n- `-t, --token`: Provides your Databricks workspace access token. (Optional)\n- `-c, --catalog`: Sets the catalog for your Databricks workspace. (Optional)\n- `-s, --schema`: Defines the schema within your Databricks workspace for migrations. Created if not exists. (Optional)\n- `-e, --env`: Sets the path to an environment file containing Databricks connection details. Defaults to `.env` in the current working directory. Supports environment variable expansion.\n- The `--noEnvFile` flag now overrides the `-e, --env` option. This means that if `--noEnvFile` is set, the tool will ignore any specified environment file path and rely solely on environment variables.\n- `-h, --help`: Displays the usage information and available options.\n\n*NOTE*\n\nIf any of the `-h, --host`, `-p, --path`, `-s, --schema`, `-c, --catalog`, or  `-t, --token` options are provided, the --noEnvFile flag will be ignored, and the tool will load environment variables from the options provided. This ensures that the user can explicitly provide connection details without relying on environment variables.\n\n**Configuration:**\n\nYou can configure the tool through a `.env` file in your project directory, which should contain key-value pairs for connection details. Alternatively, set environment variables directly in your shell and run the tool with the `--noEnvFile` flag to load values from the environment.\n\n```\nDATABRICKS_HOST=your-databricks-host\nDATABRICKS_PATH=your-databricks-path\nDATABRICKS_TOKEN=your-databricks-access-token\nDATABRICKS_CATALOG=your-databricks-catalog\nDATABRICKS_SCHEMA=your-databricks-schema\n```\n\nYou can also use the `--env` option to specify a custom path to an environment file. The tool will automatically load these values when running commands.\n\nYou can also specify these values directly as command-line options when invoking the tool.\n\n`sh\ndbsql apply --host your-databricks-host --path your-databricks-path --token your-databricks-access-token --catalog your-databricks-catalog --schema your-databricks-schema\n`\n\n**Example Usage:**\n\n1. **Initializing the migration environment:**\n\n```\ndbsql init\n```\n\n2. **Creating a new migration file:**\n\n```\ndbsql create -n my_migration_script\n```\n\n3. **Applying unapplied migrations:**\n\n```\ndbsql apply\n```\n\n4. **Resetting the schema and reapplying migrations (use with caution):**\n\n```\ndbsql reset\n```\n\n**Error Handling:**\n\nThe tool provides informative error messages if invalid commands or missing arguments are encountered. It also exits with a non-zero status code in case of errors.\n\n**Additional Notes:**\n\n- Ensure you have the necessary permissions to access and modify objects within your Databricks workspace.\n- The migration files follow a specific naming convention based on timestamps, making them easy to identify and track.\n\nBootstrapped with: [create-ts-lib-gh](https://github.com/glebbash/create-ts-lib-gh)\n\nThis project is [MIT Licensed](LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyaroslavkrutiak%2Fdatabricks-sql-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyaroslavkrutiak%2Fdatabricks-sql-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyaroslavkrutiak%2Fdatabricks-sql-cli/lists"}