Oracle support#2349
Conversation
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
…adata/soda-core into obsl-591-core-add-oracledb-support2
for more information, see https://pre-commit.ci
…data/soda-core into obsl-591-core-add-oracledb-support2
…-sql-ast' into obsl-591-core-add-oracledb-support2
…-sql-ast' into obsl-591-core-add-oracledb-support2
…data/soda-core into obsl-591-core-add-oracledb-support2
for more information, see https://pre-commit.ci
…data/soda-core into obsl-591-core-add-oracledb-support2
mivds
left a comment
There was a problem hiding this comment.
Looks pretty good! Noticed a few odd quirks though; I left a few questions/suggestions
| id | ||
| for id in [ # prefixes can be None if information schema is top-level, e.g. Oracle | ||
| *prefixes, | ||
| self.sql_dialect.schema_information_schema(), | ||
| ] | ||
| if id |
There was a problem hiding this comment.
Hmm, wondering if we can't resolve this by passing prefixes=[] to MetadataColumnsQuery.__init__? Then we use the already available interface instead of adding hidden logic here
| self.sql_dialect.column_table_name(), | ||
| col | ||
| for col in [ | ||
| self.sql_dialect.column_table_catalog(), # this could be None for some data sources e.g. Oracle |
There was a problem hiding this comment.
Is it an option to have this function return "NULL", i.e. SELECT NULL, schema_name, table_name FROM ...? That way we don't need to add conditionals here or in the result processing.
| # Attention, if dt does not have timezone info, Python will assume dt is in the local system timezone (e.g. UTC+1) | ||
| return dt.astimezone(timezone.utc).isoformat(timespec="seconds") |
There was a problem hiding this comment.
Nice find with that comment. Out of scope for this PR, but I suspect this may not be the behavior we want.
Probably want to do something like this instead:
if dt.tzinfo is None:
dt = dt.replace(tzinfo=timezone.utc)
return dt.isoformat(timespec="seconds")That would interpret the timestamp as UTC if no timezone is provided (which is more reproducible than using the local timezone). Then formats to string including timezone, which may be UTC or a previously set timezone
There was a problem hiding this comment.
Very big fan of this! Ran into issues with the "auto-conversion" that happens here.
With all the timezone stuff we're doing for this PR and for Oracle, I think we can definitely change it (if it doesn't break other things!!)
| def sql_expr_timestamp_with_tz_literal(self, datetime_in_iso8601: str) -> str: | ||
| return self.sql_expr_timestamp_literal(datetime_in_iso8601) |
There was a problem hiding this comment.
Hmm, not sure what the best approach is here. I fear this function as-is will be hard to use because you will always need to be aware of whether the datetime you have contains a timezone or not, and call the appropriate function. We could have a single function that detects if timezone is present and then acts accordingly. On the other hand that may lead to bugs because it works differently than expected.
I guess let's keep it as you've implemented it for now. We'll find out later on if there are places where we don't know which function to call.
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
…data/soda-core into obsl-591-core-add-oracledb-support2
for more information, see https://pre-commit.ci
|
* Initial oracle support * Fixes to and extensions to support OracleDB * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fixes to and extensions to support OracleDB * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fixes to and extensions to support OracleDB * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fixes to and extensions to support OracleDB * Added create_table to sql_ast * Added insert into statements to sql_ast * Added newlines to new statements so it's more readable * Updated some sql ast stuff based on needs from soda-extensions * Added drop table to the AST * Add support for Oracle * Code style updates * Add support for Oracle * Add support for Oracle * Allow insert into using select statements * Allow insert into using select statements * Additional fixes to support Oracle * Additional fixes to support Oracle * Revert accidental changes * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix test * fix package version * Fix date formatting in sqlserver * Fix date formatting in sqlserver * Parse other type of connect string * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Remove oracle * Clarify prefix joining * Clarify prefix joining * Refactor metadata queries * Fix review comments * Add comment * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Add timestamp and timestamp_tz insert tests * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Test timestamp insert * Extend test * cleanup * Fix failing tests * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Niels Bylois <niels.bylois@soda.io>
* Cleanning up the DWH tables to add the failed scan rows table * Sql dialect extensions for diagnostic warehouse * Added sql dialect max length * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * - Align naming for `STAR` alias - Remove `IN` for `STAR` because confusing - Some TODO's for typing * Align semicolon treatment in `create_schema_if_not_exists_sql` with rest of codebase * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Oracle support, AST enhancements, timezone tests (#2349) * Initial oracle support * Fixes to and extensions to support OracleDB * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fixes to and extensions to support OracleDB * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fixes to and extensions to support OracleDB * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fixes to and extensions to support OracleDB * Added create_table to sql_ast * Added insert into statements to sql_ast * Added newlines to new statements so it's more readable * Updated some sql ast stuff based on needs from soda-extensions * Added drop table to the AST * Add support for Oracle * Code style updates * Add support for Oracle * Add support for Oracle * Allow insert into using select statements * Allow insert into using select statements * Additional fixes to support Oracle * Additional fixes to support Oracle * Revert accidental changes * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix test * fix package version * Fix date formatting in sqlserver * Fix date formatting in sqlserver * Parse other type of connect string * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Remove oracle * Clarify prefix joining * Clarify prefix joining * Refactor metadata queries * Fix review comments * Add comment * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Add timestamp and timestamp_tz insert tests * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Test timestamp insert * Extend test * cleanup * Fix failing tests * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Niels Bylois <niels.bylois@soda.io> * Add new plugin stubs for request proposals (#2361) * Add new plugin stubs for request proposals * Add create schema support for DuckDB --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Niels Nuyttens <niels@soda.io> Co-authored-by: paulteehan <45394252+paulteehan@users.noreply.github.com> Co-authored-by: Niels Bylois <niels.bylois@soda.io> Co-authored-by: Lauren De bruyn <lauren@soda.io>



Oracle implementation in soda-core. Tests passing locally, I think CI may not be configured yet. Ready for review.
Still pending: