[Trex] add session variables for TREX HANA sql execution#181
[Trex] add session variables for TREX HANA sql execution#181Zhimin-arya wants to merge 2 commits into
Conversation
|
|
||
|
|
||
| getConnection(db_id, schema, vocab_schema, result_schema, translationMap) { | ||
| getConnection(db_id, schema, vocab_schema, result_schema, translationMap, sessionVariables = {}) { |
There was a problem hiding this comment.
allow callers such as parquet-export to provide session variables
| } | ||
| } | ||
|
|
||
| fn parse_session_vars(json: &str) -> Result<BTreeMap<String, String>, Box<dyn Error>> { |
There was a problem hiding this comment.
The fn is copied from hana_materialize.rs using same logic to set application session variable
| } | ||
| let (column_names, column_types, temporal_cols) = match safe_hana_connect(url.clone()) { | ||
| Ok(connection) => { | ||
| apply_session_vars(&connection, &session_vars)?; |
There was a problem hiding this comment.
Apply variables to the schema-detection connection
| for attempt in 0..=bind_data_ref.max_retries { | ||
| match safe_hana_connect(bind_data_ref.url.clone()) { | ||
| Ok(connection) => { | ||
| apply_session_vars(&connection, &bind_data_ref.session_vars)?; |
There was a problem hiding this comment.
Apply variables to the execution connection
| duckdb::core::LogicalTypeHandle::from(LogicalTypeId::Varchar), | ||
| ]) | ||
| } | ||
| fn named_parameters() -> Option<Vec<(String, duckdb::core::LogicalTypeHandle)>> { |
There was a problem hiding this comment.
named_parameters() tells DuckDB:
trex_hana_scan accepts an optional input called session_vars_json, and its value must be text.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #181 +/- ##
===========================================
- Coverage 52.66% 52.62% -0.04%
===========================================
Files 168 168
Lines 72584 72630 +46
===========================================
- Hits 38223 38219 -4
- Misses 34361 34411 +50
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
No description provided.