Quantco / pytsql

Run mssql scripts from Python.
BSD 3-Clause "New" or "Revised" License
14 stars 3 forks source link

Full support for linked servers #39

Closed EnchoMishinevQC closed 2 years ago

EnchoMishinevQC commented 2 years ago

TSQL supports linked servers in which case table identifiers consist of 4 parts - [linked_server].[database].[schema].[table_name]. We have a construct that supports this called full_table_name, but in most places table_name is used instead. The only difference is that the former supports linked servers, while the latter doesn't.

I've received a request to support linked servers recently and I could not think of a good reason why we'd ever "forbid" a linked server identifier. The full_table_name should be a strict superset of what it supports compared to table_name, so this should be fully backwards compatible.

The non-auto-generated grammar changes can be found in the first commit to ease reviews.