Skip to main content

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


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.0.4.tar.gz (39.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.0.4-py3-none-any.whl (44.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sqlscope-1.0.4.tar.gz
  • Upload date:
  • Size: 39.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.0.4.tar.gz
Algorithm Hash digest
SHA256 e0635084d6a646ce7a0ed3647c2d8a3809c8778eaf8399cfc4d46c6f8b58c9f7
MD5 178b6c6f8c57528e82e0a71273617d32
BLAKE2b-256 a7bd5818d8c9cd4236bf8c74c7a533916d8c7339ab51746c9e6a596f7d3c05bc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sqlscope-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 44.9 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.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a56b7aed92b4bb26c297fc7ce6d58cc6417067252ce0c56ade223d06a1de1ff0
MD5 b2d00c1072b35645e43f3a1ac5e4fd77
BLAKE2b-256 a936cc1f71f30151b9b413c3bcd33ca128e4af4a03dcffa3f10c241bcde1f408

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page