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

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.2.0
File Size Uploaded Provenance Actions
sqlscope-1.2.0.tar.gz 52.0 kB Without provenance Details for sqlscope-1.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 104.3 kB

Release files / sqlscope-1.2.0.tar.gz

Download URL sqlscope-1.2.0.tar.gz
Size 52.0 kB
Tags Source
SHA-256 checksum
How to use checksums
0238a89130282fd6c8a2057c47431a470fc89c9cfd5dc7ae239d5b998840cb4e
BLAKE2b-256 checksum
How to use checksums
298a5cf52c346f6bb9afad57fcdffb3b80d582d3f0bdf368c19816bfff4a0bb7
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.2.0-py3-none-any.whl

Download URL sqlscope-1.2.0-py3-none-any.whl
Size 52.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7dbfa7739fd07b75e2f2ca5b32211eaba352ff1ce15ab56b8c545d8f5e6032b5
BLAKE2b-256 checksum
How to use checksums
12844323c3c9e5abf60ddecdffcf4e0a4879a2f662b7c5cd3690c4b7b799c734
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.2.0

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