This project extracts catalog and query metadata from a SQL query.
Project description
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 [...])
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sqlscope-1.0.8.tar.gz.
File metadata
- Download URL: sqlscope-1.0.8.tar.gz
- Upload date:
- Size: 39.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
406f6942a7b1ec0d5996ab5cc6074f894857cac9031eb6c9e0cc8a26bc6fe8d5
|
|
| MD5 |
d6d5dac1e82d0c4bc3be9d9f4b2922d1
|
|
| BLAKE2b-256 |
04676757aaeb3708adf7aaea8ee781629b1532c95c0fc765ab7a179253b60c9c
|
File details
Details for the file sqlscope-1.0.8-py3-none-any.whl.
File metadata
- Download URL: sqlscope-1.0.8-py3-none-any.whl
- Upload date:
- Size: 45.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7c85450021021d5ce8b7ceb896811fe9bb51529bac80af919466fad8962ad8f
|
|
| MD5 |
f37e55a8c0fbb70873aa4dabffa6ac91
|
|
| BLAKE2b-256 |
483ad3e03e997a6b49aa51833aa05f5c6977c2648c70479a4ff6fa1beae6f4e4
|