Skip to main content

PySqlParse

Find table names and other information in a SQL query

Installation

pip3 install pysqlparse

Use

Import

from pysqlparse import parser
...

get_table_names

Returns a set of all table names (without aliases) found in the SQL string.

from pysqlparse import parser
print(parser.get_table_names('''
        SELECT *
            FROM requests.by_account m
            INNER JOIN customer_data.styles s ON m.version = s.id
            LEFT JOIN profiles.users u ON m.csm = u.id
      '''))

Returns:

{'request.by_account', 'customer_data.styles', 'profiles.users'}

Download files

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

Source Distribution

pysqlparse-0.0.2.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

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

pysqlparse-0.0.2-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file pysqlparse-0.0.2.tar.gz.

File metadata

  • Download URL: pysqlparse-0.0.2.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.9

File hashes

Hashes for pysqlparse-0.0.2.tar.gz
Algorithm Hash digest
SHA256 2073e2361e629104356fade4cc4126adb8c0c4ae734baa22047c89f17ddfe41a
MD5 75011bcb9b8121bf92a86be4d2385f85
BLAKE2b-256 5675a07aa2f2f0ca30b3d32b73a66978c271f93476e411d5f37a57ea740a26a4

See more details on using hashes here.

File details

Details for the file pysqlparse-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: pysqlparse-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.9

File hashes

Hashes for pysqlparse-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 add4843b2ddd550f006899005b3e22cca610f0ddec8fb8585738d45cf22e8b33
MD5 2aaaea0e6221dffb7a9dd47a1c2d8636
BLAKE2b-256 3a7111bd1ae39b4a04dc8ea5931bda0ff09925ead815211caa8fa1db975e418c

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 files

0.0.1

1 file

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