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.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 sqlscope 1.1.1
File Size Uploaded
sqlscope-1.1.1.tar.gz 51.6 kB Details

Built distribution (wheel)

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

Total release size: 103.8 kB

Release files / sqlscope-1.1.1.tar.gz

Download URL sqlscope-1.1.1.tar.gz
Size 51.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6174180835a49d5bd80590b0ad885f1c94c3b28f7ce55be7f9fee8b79f0374d0
BLAKE2b-256 checksum
How to use checksums
6885163fbe82a978a92cf835ecd51bc51c6c113929387ac4b6f0bff0ed29a837
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

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

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

Release history Release notifications | RSS feed

This release

1.1.1 This release

2 release files

1.1.0

2 release files

1.0.15

2 release files

1.0.14

2 release files

1.0.13

2 release files

1.0.12

2 release files

1.0.11

2 release files

1.0.10

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

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