Access schema from connection-builder
xsgao-github opened this issue · comments
About You:
Name: Song Gao
Company: Starburst Data
Your question:
According to this doc, we can access database name from connection-builder
. But can we access schema?
Internal tracking W-13719188
The schema
value may or may not be available depending on the scenario. What is your goal with this value? Generally the schema is included as a prefix to the selected table name.
In Starburst Galaxy, users can select catalog/schema to use, and write queries without qualifying table names, e.g. select * from customers
. Then they click on a button to download a .tds
that embeds this query as a Custom SQL
.
In connectionBuilder.js
or connectionProperties.js
, I would like to access named-connection/connection[@schema]
attribute and pass it as a parameter to JDBC driver. Without that, the Custom SQL will fail because it does not know which schema to use.
In a connector that supports Schema, it is expected that a Custom SQL query would be schema qualified. For example this is what Tableau Desktop produces when a selected Table is Converted to Custom SQL:
SELECT "testv1_calcs"."key" AS "key"
FROM "testv1_raw"."testv1_calcs" "testv1_calcs"
But in the Starburst Galaxy query editor, users can specify shema in the UI and use unqualified table names. If we can access the named-connection/connection[@schema]
attribute from .tds
, we can format the JDBC URL accordingly to include schema. This will simplify the user experience.
We don't treat schemas like that in our model. However, you can use other attributes to refer to your schemas (attrDatabase or attrCatalog). Just make sure that you also include it in the "required attributes" which are used to create the key for the connection pool (since the connection is now tied to one of your schemas).