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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file horst-0.3.15.tar.gz
.
File metadata
- Download URL: horst-0.3.15.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e5ecd22eca13786260d6ec699aee8dc704c20946ba5ec80a2546347c8a4f3ce |
|
MD5 | d84dfeaffb74f1dc91b904152e047187 |
|
BLAKE2b-256 | 3e4939c8d3a58230c955ac7545d43bd518ccc8dbfa87f40325a89175759955b4 |
File details
Details for the file horst-0.3.15-py3-none-any.whl
.
File metadata
- Download URL: horst-0.3.15-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d7af7656c13982fd2ef8940d449d72267e364abb87db1f037ab1aec734b549f |
|
MD5 | 1dbfda6b0d03db55d2c5accabae59491 |
|
BLAKE2b-256 | 665ad03c87569f29f9d7e344e1cecdbd294a81de116f4a1a9e1dbbf648f4d004 |