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 [...])

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sqlscope-1.1.0.tar.gz (51.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sqlscope-1.1.0-py3-none-any.whl (51.8 kB view details)

Uploaded Python 3

File details

Details for the file sqlscope-1.1.0.tar.gz.

File metadata

  • Download URL: sqlscope-1.1.0.tar.gz
  • Upload date:
  • Size: 51.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for sqlscope-1.1.0.tar.gz
Algorithm Hash digest
SHA256 f75ab1f03fdd0c2ee58ccc957391f401973d24de4c9f9682b39eae462c6c192e
MD5 ae847b3e407c98025609c27967817838
BLAKE2b-256 2e2ff5514e9807d7a40bdf3ab1cef3bdbc82542f85817b4ca0053b28aa4a1be2

See more details on using hashes here.

File details

Details for the file sqlscope-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: sqlscope-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 51.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for sqlscope-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b378451fbe0eec9ead5c14eb450c89491faef2612fbfc7da7d1d9f0004aec7b2
MD5 bae7a73822f12be7a228b63af3ccb999
BLAKE2b-256 0ea4fd78c5e3717348b749dcc83db857d9530d37ec7dd90362b803ef7b81f3c8

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 files

1.0.16

2 files

1.0.15

2 files

1.0.14

2 files

1.0.13

2 files

1.0.12

2 files

1.0.11

2 files

1.0.10

2 files

1.0.9

2 files

1.0.8

2 files

1.0.7

2 files

1.0.6

2 files

1.0.5

2 files

1.0.4

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 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