sql-metadata icon indicating copy to clipboard operation
sql-metadata copied to clipboard

Uses tokenized query returned by python-sqlparse and generates query metadata

Results 102 sql-metadata issues
Sort by recently updated
recently updated
newest added

Currently, the querying of Parquet files is not handled correctly. Columns are interpreted correctly, just not the tables part (as expected). Following an example of a Parquet query, using `OPENROWSET`:...

enhancement
Parquet

Bug that I see, it cant detect some columns: ``` from sql_metadata import Parser def extract_columns_from_schema(schema_string): # Initialize the parser with the schema string parser = Parser(schema_string) # Extract columns...

bug

Suppose we have a new schema as a text. How to extract columns from new schema same as PRAGMA table_info? Actually I want to compare new schema (provided as a...

When writing a SQL query using MSSQL it does not recognize the `DECLARE` statement. Example: ```sql DECLARE @SpecifiedName NVARCHAR(10) = '%LEX%'; ``` The produced error: ``` ValueError: Not supported query...

enhancement
SQL Server

I have the below sql query in MSSQL. ```sql SELECT ap.[AccountId], (SELECT COUNT(*) FROM [Transactions] t WHERE t.[AccountId] = ap.[AccountId]) AS TransactionCount FROM [AccountProfiles] ap ``` I am using the...

bug
SQL Server

Using the method `parser.tables_aliases` it brings back `GROUP BY` as a table alias in MSSQL. ``` Tables Aliases: {'GROUP BY': '[Table1]', 't3': '[Table1]', 't4': '[Table2]', 't1': '[Table3]', 't2': '[Table4]'} ```...

I used sql_metadata to extract columns of sql text, version is "2.6.0" But gradually I found this library brought a big issue, as shown in the figure below. ![Image](https://github.com/user-attachments/assets/a41fd484-7d9b-4957-99c8-acd3e90e111e) Anyone...

version: 2.15.0 This is a demo which can reproduce this bug. ```python def test_hang(self): from sql_metadata import Parser s = """WITH a AS (SELECT MAX(b) AS c FROM d WHERE...

bug

using `tables: List[str] = Parser(sql_file_content).tables` where part of sql_file_content is `INNER JOIN my_db_name.ipps_wage_index_annual WI ON OPR.year = WI.cms_year` `INNER JOIN my_db_name.geo_county_cbsa CBS ON WI.cbsa_cd = COALESCE(CBS.metropolitan_division_code, CBS.cbsa_code, SUBSTRING(CBS.ssa_codes, 1, 2))`...

hello, I have a Feature Reques, please check if necessary ```python from sql_metadata import Parser parser = Parser("INSERT INTO (field1,field2) VALUES (1,2), (1,2);") print(parser.values_dict) #{'field1': 1, 'field2': 2} ``` the...