{"id":16400992,"url":"https://github.com/moertel/squcumber-redshift","last_synced_at":"2025-06-21T23:38:01.711Z","repository":{"id":59156257,"uuid":"63496817","full_name":"moertel/sQucumber-redshift","owner":"moertel","description":"Cucumber-based framework for defining and executing SQL unit, integration and acceptance tests (for AWS Redshift, PostgreSQL)","archived":false,"fork":false,"pushed_at":"2020-09-30T18:13:25.000Z","size":29,"stargazers_count":13,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-21T23:37:46.457Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/moertel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-07-16T18:25:38.000Z","updated_at":"2020-02-24T10:18:46.000Z","dependencies_parsed_at":"2022-09-13T20:11:32.154Z","dependency_job_id":null,"html_url":"https://github.com/moertel/sQucumber-redshift","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/moertel/sQucumber-redshift","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moertel%2FsQucumber-redshift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moertel%2FsQucumber-redshift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moertel%2FsQucumber-redshift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moertel%2FsQucumber-redshift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/moertel","download_url":"https://codeload.github.com/moertel/sQucumber-redshift/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moertel%2FsQucumber-redshift/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261211723,"owners_count":23125545,"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-10-11T05:29:10.397Z","updated_at":"2025-06-21T23:37:56.640Z","avatar_url":"https://github.com/moertel.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sQucumber Redshift\n\n[![Gem Version](https://badge.fury.io/rb/squcumber-redshift.svg)](https://badge.fury.io/rb/squcumber-redshift) [![Dependency Status](https://gemnasium.com/badges/github.com/moertel/sQucumber-redshift.svg)](https://gemnasium.com/github.com/moertel/sQucumber-redshift) [![Build Status](https://travis-ci.org/moertel/sQucumber-redshift.svg?branch=master)](https://travis-ci.org/moertel/sQucumber-redshift) [![Test Coverage](https://codeclimate.com/github/moertel/sQucumber-redshift/badges/coverage.svg)](https://codeclimate.com/github/moertel/sQucumber-redshift/coverage) [![Gitter](https://img.shields.io/gitter/room/sQucumber/sQucumber.js.svg?maxAge=2592000?style=flat)](https://gitter.im/moertel/sQucumber)\n\nBring the BDD approach to writing SQL for your Amazon Web Services Redshift cluster and be confident that your scripts do what they're supposed to do. Define and execute SQL unit, acceptance and integration tests and let them serve as a living documentation for your queries. It's Cucumber - for SQL!\n\n## Example\n\nSuppose you want to test that `kpi_reporting.sql` is producing correct results; its `.feature` file could look as follows:\n```cucumber\n# features/kpi_reporting.feature\n\nFeature: KPI Reporting\n\n  Scenario: There are some visitors and some orders\n    Given the existing table \"access_logs\":\n      | req_date   | req_time | request_id |\n      | 2016-07-29 | 23:45:16 | 751fa12d-c51e-4823-8362-f85fde8b7fcd |\n      | 2016-07-31 | 22:13:54 | 35c4699e-c035-44cb-957c-3cd992b0ad73 |\n      | 2016-07-31 | 11:23:45 | 0000021d-7e77-4748-89f5-cddd0a11d2f9 |\n    And the existing table \"orders\":\n      | order_date | product |\n      | 2016-07-31 | Premium |\n    When the SQL file \"kpi_reporting.sql\" is executed\n    And the resulting table \"kpi_reporting\" is queried\n    Then the result exactly matches:\n      | date       | visitors | orders |\n      | 2016-07-29 | 1        | 0      |\n      | 2016-07-31 | 2        | 1      |\n```\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'squcumber-redshift'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install squcumber-redshift\n\n## Usage\n\nPut your `.feature` files in the directory `feature` in your project's root. (You may use subfolders.)\nIn order to take advantage of auto-generated Rake tasks, add this to your `Rakefile`:\n```ruby\nrequire 'squcumber-redshift/rake/task'\n```\n\nThe following folder structure\n```\n└── features\n    ├── marketing\n    │   ├── sales.feature\n    │   └── kpi.feature\n    └── development\n        └── logs\n            └── aggregate.feature\n```\nLeads to the following Rake tasks:\n```\n$ rake -T\nrake test:sql:marketing                                         # Run SQL tests for all features in marketing\nrake test:sql:marketing:sales[scenario_line_number]             # Run SQL tests for feature marketing/sales\nrake test:sql:marketing:kpi[scenario_line_number]               # Run SQL tests for feature marketing/kpi\nrake test:sql:development                                       # Run SQL tests for all features in development\nrake test:sql:development:logs                                  # Run SQL tests for all features in development/logs\nrake test:sql:development:logs:aggregate[scenario_line_number]  # Run SQL tests for feature development/logs/aggregate\n```\n\nRun a whole suite of features by executing a Rake task on the folder level:\n```\nrake test:sql:marketing\n```\n\nOr execute a specific scenario only by specifying its line number in the corresponding `.feature` file:\n```\nrake test:sql:marketing:sales[12]\n```\n\n### Environment Variables\n\nMake sure the following environment variables are set when running sQucumber's Rake tasks:\n\n| Name | Description |\n| ---- | ----------- |\n| REDSHIFT_HOST | Hostname of the AWS Redshift cluster |\n| REDSHIFT_PORT | Redshift port to connect to |\n| REDSHIFT_USER | Name of the Redshift user to use to create a testing database, must be a superuser |\n| REDSHIFT_PASSWORD | Password of the Redshift user |\n| REDSHIFT_DB | Name of the DB on the Redshift cluster |\n\nOptional environment variables:\n\n| Name | Value | Description | Default |\n| ---- | ----- | ----------- | ------- |\n| SPEC_SHOW_STDOUT | 1 | Show output of statements executed on the Redshift cluster | 0 |\n| KEEP_TEST_DB | 1 | Do not drop the database after test execution (useful for manual inspection) | 0 |\n| TEST_DB_NAME_OVERRIDE | _String_ | Define a custom name for the testing database created on the cluster. Setting this to `foo` will result in the database `test_env_foo` being created | random 5-digit integer |\n\n\n## Contributing\n\n1. Fork it ( https://github.com/moertel/squcumber-redshift/fork )\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoertel%2Fsqucumber-redshift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoertel%2Fsqucumber-redshift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoertel%2Fsqucumber-redshift/lists"}