Skip to main content

Introduction

This project extracts catalog and query metadata from a SQL query. Each SELECT statement is parsed as a list of tokens as well as an AST. The former works even for incomplete or invalid SQL queries, while the latter requires a valid SQL syntax. Additionally, catalog metadata is extracted from the database schema.

Details

For each SELECT statement, the package extracts:

  • the list of SELECT queries (in case of set operations, nested queries, or ctes)
  • the main SELECT query
  • the list of schemas/tables/columns available in the catalog
  • the list of tables referenced in each query
  • the resulting table from each query execution, including its columns and their types
  • each clause of each query

The catalog extract schema/table/column metadata. For each column, the following information are extracted:

  • name
  • data type
  • nullability
  • foreign key

Additionally, for each table, PRIMARY KEY/UNIQUE constraints are extracted. This is also computed for the result of each SELECT query.

Credits

Special thanks to Flavio Venturini for his valuable contributions to the development of this project.

Limitations

  • Fully identified schema names are not supported when specifying column names (e.g. SELECT schema.table.column [...])

Metadata

Release files for sqlscope 1.1.2

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

Source distribution (sdist)

Source distribution for sqlscope 1.1.2
File Size Uploaded Provenance Actions
sqlscope-1.1.2.tar.gz 51.6 kB Without provenance Details for sqlscope-1.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sqlscope 1.1.2
File Interpreter ABI Platform Actions
sqlscope-1.1.2-py3-none-any.whl Python 3 none any Details for sqlscope-1.1.2-py3-none-any.whl

Total release size: 103.8 kB

Release files / sqlscope-1.1.2.tar.gz

Download URL sqlscope-1.1.2.tar.gz
Size 51.6 kB
Tags Source
SHA-256 checksum
How to use checksums
b41ba639fd590fd4c0c6a1235a410a647416a6f7fef028b3e4ce3d949c11a1fa
BLAKE2b-256 checksum
How to use checksums
df92a709899a460929d41ab6b71e528a522f0659dc2c2d6da111797287b767a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release files / sqlscope-1.1.2-py3-none-any.whl

Download URL sqlscope-1.1.2-py3-none-any.whl
Size 52.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d3bad18c9798e6dfb7cbdfb0fa703dc35702feb15c9e44365156b9b5f50293e0
BLAKE2b-256 checksum
How to use checksums
96b160098e11e71b49b817f6db9737a265e14e23b87317f1996333ae06ea1cf1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Security for sqlscope 1.1.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.

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