Skip to main content

Do not repeat yourself in SQL scripts by listing the same fields again and again.

Project description

horst makes it more easy to handle many depending SQL statements in a SQL script or SQL procedure. The main support of horst is: Identical field lists in SELECT, INSERT, JOIN, WHERE, GROUP are managed at ONE code line.

I created horst to manage the beast of data transformation with a chain of SQL statements in SQL procedures. In these procedures we use temporary tables to collect records, transform these records and write the results into the target table. Each additional new information aka field was a pain in the ass as we have to investigate where to add these new field. With horst it became a nice task.

supported SQL languages

.Google BigQuery

Extended BNF of horst

statement = table_declaration
| clone_table
| drop tables
| list_fields
| join_fields
| comment

table_declaration = create table table_name field_list
clone_table = clone table ID as ID {add field_list | without field_names}
list_fields = table_name {as table_alias} fields {with type} {without field_names}
join_fields = table_name {as table_alias} on table_name {as table_alias} {(with | without) field_names}
comment = -- *

field_list = field_definition {, field_definition}
field_definition = field_name field_type
field_type = INTEGER | STRING | TIMESTAMP
field_names = field_name {, field_name}
field_name = ID
table_name = ID
table_alias = ID
ID = RegEx([a-zA-Z_][a-zA-Z0-9_]*) \

code example
$ python horst.py this_horst_script
file with horst code: horst.this_horst_script.sql
result sql file: this_horst_script.sql

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

horst-0.3.11.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

horst-0.3.11-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file horst-0.3.11.tar.gz.

File metadata

  • Download URL: horst-0.3.11.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.5

File hashes

Hashes for horst-0.3.11.tar.gz
Algorithm Hash digest
SHA256 a250f1a2b62135ed6584c29a0ee0784e8631dc925b63cece60c85599c12cef87
MD5 2e44d73cf1fe4bf8187443b630c7e95d
BLAKE2b-256 6e2be5be2f97d0e00d84063a65330f4f484ba2cf6781d87d6ece29a7d879d6f6

See more details on using hashes here.

File details

Details for the file horst-0.3.11-py3-none-any.whl.

File metadata

  • Download URL: horst-0.3.11-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.5

File hashes

Hashes for horst-0.3.11-py3-none-any.whl
Algorithm Hash digest
SHA256 7fd160ca16e71389e7f548ca8e08b2773d257f5059fda6dd350aa7f831552750
MD5 a7670a07884ab5c5433af4dbee9fe0c0
BLAKE2b-256 31dd7de90b6a8c7f48ea4ba9a358a20b0c37804d5f4582a779f1c4a197180974

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page