sql-metadata
sql-metadata copied to clipboard
Uses tokenized query returned by python-sqlparse and generates query metadata
```python test_sql = ''' SELECT * FROM test t join test_1 t1 on datetrunc('day', t.test_date) = datetrunc('day', t1.test_date) ''' def extract_tables_with_sql_metadata(sql): try: parser = Parser(sql) return parser.tables except: return []...
sql = "create temporary table M_ZJM_qy2 DISTRIBUTED BY('B_dkhth') select B_dkhth,B_khh,CONCAT(F,F_jjbh,F_bz,F_jjje,F_jjye,F_fkrq,F_fkdqr,rtrim(F_dkywzl),F_dkxs,F_dkxz,F_dktx,F_dkzl,F_zqbz,F_sjfl,F_wjfl) F from m_zjm_dkywxx_f where beiz = '' and B_dkhth '' and B_dkhth = any(select B_dkhth from M_ZJM_qy1)" # use SQL...
Table names or column names enclosed within single quotes `'` are supported in sqlite, but it seems that sql-matedata cannot parse them. How to solve this problem? For example: ```python...
I just ran this example, which is adjusted from one of the examples on the README. ```python # foo.py from sql_metadata import Parser parser = Parser( """ WITH database1.tableFromWith AS...
Hi sql-metadata developers! I have just been playing around with the examples, and I love the idea of this package. Being able to extract meta-data about SQL queries can help...
When i handled sql like below, 'b.col1' is recognized as a table name in Parser.tables: sql:"from table1 a left join table2 b on ifnull(a.col1, '') = ifnull(b.col1, '')" When I...
``` Python 3.11.8 (main, Aug 16 2024, 10:27:21) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from importlib.metadata import version >>> import sql_metadata...
Bumps [actions/cache](https://github.com/actions/cache) from 4 to 5. Release notes Sourced from actions/cache's releases. v5.0.0 [!IMPORTANT] actions/cache@v5 runs on the Node.js 24 runtime and requires a minimum Actions Runner version of 2.327.1....
Hello, if a column named 'source' is the last column in a SELECT statement, it gets dropped from the list returned by Parser(sql_str).columns. If 'source' is moved to another place...
Hi, I have code using sql_metadata lib. Mypy execution on this repo return following result: ``` Skipping analyzing "sql_metadata.parser": module is installed, but missing library stubs or py.typed marker [import-untyped]...