Skip to main content

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"

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.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ahi-sql 0.2.1
File Size Uploaded Provenance Actions
ahi_sql-0.2.1.tar.gz 5.0 kB Without provenance Details for ahi_sql-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ahi-sql 0.2.1
File Interpreter ABI Platform Actions
ahi_sql-0.2.1-py3-none-any.whl Python 3 none any Details for ahi_sql-0.2.1-py3-none-any.whl

Total release size: 9.9 kB

Release files / ahi_sql-0.2.1.tar.gz

Download URL ahi_sql-0.2.1.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ae10ac7136ec2bede9de08e65ba5439811192f057a895c817ba32560ab3cc383
BLAKE2b-256 checksum
How to use checksums
1f7253f1c8139e466179e65d0e6a08f0dd5d029bd3d4372c4111f32cd7c05bc9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / ahi_sql-0.2.1-py3-none-any.whl

Download URL ahi_sql-0.2.1-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d375bd0248fb091f1704b1e940e68b1ce1dd67dca27e758a46b54078952718ab
BLAKE2b-256 checksum
How to use checksums
1dca83ebef3e6747bd47fd77ca79ffe086dfcfded73f77e86ef80f3b5d8f63b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for ahi-sql 0.2.1

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page