ChrisJaunes

Results 3 comments of ChrisJaunes

You can use "splparse.parse" to parse this complex query, then you can iterate over tokens and get cloumns from "select token" and "from token". Note that it is handled according...

more, you can refer to https://github.com/andialbrecht/sqlparse/blob/master/examples/extract_table_names.py

If you need to extract the outermost columns, some modifications are required for example: ```python if __name__ == "__main__": sql = """SELECT "Gender" AS "Gender", "Ethnicity" AS "Ethnicity", count(*) AS...