Parsing 3 part table names
See original GitHub issueHello, is it possible for me to configure sqllineage to understand 3 part (database.schema.table) formatted names? My queries reference all tables in this format but the output is not as expected for them, it’s only getting the first 2 parts which are the database and schema. Thanks for any feedback or advice here.
Example vs expected output below:
sqllineage -e "CREATE OR REPLACE TABLE dbname.schemaname.tablename AS SELECT o.* FROM dbn.scn.orders o JOIN dbn.scn.users u ON o.id = u.id;"
Statements(#): 1
Source Tables:
dbn.scn
Target Tables:
dbname.schemaname
Expected source tables:
dbn.scn.orders
dbn.scn.users
Expected target table:
dbname.schemaname.tablename
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Parsing Table Names from SQL - Gregory Trubetskoy
In SQL table names always follow the FROM and JOIN keywords. So all you have to do is split the statemement into tokens,...
Read more >JR60788: DB2 Connector fails while parsing 3-part table name
DB2 Connector code has been altered so the table name in SQL query containing database and schema is properly parsed. Temporary fix. Comments ......
Read more >Parse table names from a bunch SQL statements
SQL> ed Wrote file afiedt.buf 1 SELECT table_owner, table_name 2 FROM dba_indexes 3 WHERE owner = 'SCOTT' 4* AND index_name = 'PK_DEPT' SQL> ......
Read more >Parsing SQL for Table Names - SQLServerCentral
Recently I've discovered another useful SQL parser called MacroScope ... script for finding all table names and aliases within a SQL string:
Read more >Extracting Table Names, Dataset From SQL Queries - Medium
How to use Python to extract datasets and table names from plaintext SQL queries.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
FWIW - Redshift has the same convention
I actually think this is an interesting use case given Snowflake as a data warehouse solution supports this. Let me check if there’s anything I can do.
I think the bottom line is, for a table named as db.schema.tbl, the last thing we would give end user as full table name is db.schema. No doubt db.schema.tbl as full name is the desired answer, but at least we should try give end user schema.tbl.