ahi-sql
Small, dependency-light SQL helpers — the bits people otherwise hand-roll and get subtly wrong: quoting identifiers, generating bind placeholders, and building the DDL for a staged lookup table.
from ahi.sql import quote_identifier, placeholders
quote_identifier("user table") # '"user table"'
placeholders(3, style="qmark") # '?, ?, ?' (Athena)
placeholders(3, style="named") # ':1, :2, :3' (Redshift Data API)
Quote identifiers with
quote_identifier. Quote values by passing them as bind parameters to your driver — never by string-formatting them in.
It also builds the DDL behind a staged lookup table — text only, so you can read and adapt the statement without running anything:
from ahi.sql import create_external_id_table, drop_table
create_external_id_table(
"ahi_ids_a1b2c3d4", # table
"s3://my-bucket/scratch/ahi_ids_a1b2c3d4/", # location
"encounter_id", # column
database="scratch",
)
# CREATE EXTERNAL TABLE `scratch`.`ahi_ids_a1b2c3d4` ( `encounter_id` bigint ) ...
drop_table("ahi_ids_a1b2c3d4", database="scratch")
# DROP TABLE IF EXISTS `scratch`.`ahi_ids_a1b2c3d4`
Athena escapes identifiers with backticks in DDL (Hive) and double quotes in
SELECT(Trino). The builders emit backticks;qualifydefaults to double quotes for the query side.
ahi.aws.stage_id_table runs these for you; see the
ahi-aws README.
Part of ahi-python-packages.
Metadata
Release files for ahi-sql 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ahi_sql-0.2.2.tar.gz | 6.4 kB | Without provenance | Details for ahi_sql-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ahi_sql-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for ahi_sql-0.2.2-py3-none-any.whl |
Total release size: 12.1 kB
Release files / ahi_sql-0.2.2.tar.gz
| Download URL | ahi_sql-0.2.2.tar.gz |
|---|---|
| Size | 6.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3f20f7e95da206baf98bc3c8e035eaf90011a51c2982a90ce640973bd775ce06
|
|
BLAKE2b-256 checksum How to use checksums |
50b51c7c749b48a2407aac81fe139c1360ac0f85c8adf7cc8e255fb3b3afce8a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / ahi_sql-0.2.2-py3-none-any.whl
| Download URL | ahi_sql-0.2.2-py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
26e8c4e703efeadf788b088de4cb2ee180d45bb2ea6e2c51ece06810d58d524e
|
|
BLAKE2b-256 checksum How to use checksums |
a2a15c761696662f6e4312c5c7d70ef0398805c5d882757e4f50bf1e501c14d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for ahi-sql 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.