Extract table names and other information from SQL queries
Project description
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'}
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
pysqlparse-0.0.2.tar.gz
(5.7 kB
view details)
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 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2073e2361e629104356fade4cc4126adb8c0c4ae734baa22047c89f17ddfe41a
|
|
| MD5 |
75011bcb9b8121bf92a86be4d2385f85
|
|
| BLAKE2b-256 |
5675a07aa2f2f0ca30b3d32b73a66978c271f93476e411d5f37a57ea740a26a4
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
add4843b2ddd550f006899005b3e22cca610f0ddec8fb8585738d45cf22e8b33
|
|
| MD5 |
2aaaea0e6221dffb7a9dd47a1c2d8636
|
|
| BLAKE2b-256 |
3a7111bd1ae39b4a04dc8ea5931bda0ff09925ead815211caa8fa1db975e418c
|