Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added query history retrieval from Snowflake #874

Merged
merged 2 commits into from
Aug 30, 2024
Merged

Added query history retrieval from Snowflake #874

merged 2 commits into from
Aug 30, 2024

Conversation

nfx
Copy link
Collaborator

@nfx nfx commented Aug 30, 2024

No description provided.

@nfx nfx requested a review from a team as a code owner August 30, 2024 18:47
@nfx nfx requested a review from himanishk August 30, 2024 18:47
Copy link

Coverage tests results

430 tests  ±0   381 ✅ ±0   5s ⏱️ -1s
  5 suites ±0     0 💤 ±0 
  5 files   ±0    49 ❌ ±0 

For more details on these failures, see this check.

Results for commit b21c672. ± Comparison against base commit 287822e.

@nfx nfx merged commit cb217c0 into main Aug 30, 2024
9 checks passed
@nfx nfx deleted the feat/discovery branch August 30, 2024 18:58
nfx added a commit that referenced this pull request Sep 16, 2024
* Added query history retrieval from Snowflake ([#874](#874)). This release introduces query history retrieval from Snowflake, enabling expanded compatibility and data source options for the system. The update includes adding the Snowflake JDBC driver and its dependencies to the `pom.xml` file, and the implementation of a new `SnowflakeQueryHistory` class to retrieve query history from Snowflake. The `Anonymizer` object is also added to anonymize query histories by fingerprinting queries based on their structure. Additionally, several case classes are added to represent various types of data related to query execution and table definitions in a Snowflake database. A new `EnvGetter` class is also included to retrieve environment variables for use in testing. Test files for the `Anonymizer` and `SnowflakeQueryHistory` classes are added to ensure proper functionality.
* Added support for `ALTER TABLE`: `ADD COLUMNS`, `DROP COLUMNS`, `RENAME COLUMNS`, and `DROP CONSTRAINTS` ([#861](#861)). In this release, support for various `ALTER TABLE` SQL commands has been added to our open-source library, including `ADD COLUMNS`, `DROP COLUMNS`, `RENAME COLUMNS`, and `DROP CONSTRAINTS`. These features have been implemented in the `LogicalPlanGenerator` class, which now includes a new private method `alterTable` that takes a context and an `AlterTableCommand` object and returns an `ALTER TABLE` SQL statement. Additionally, a new sealed trait `TableAlteration` has been introduced, with four case classes extending it to handle specific table alteration operations. The `SnowflakeTypeBuilder` class has also been updated to parse and build Snowflake-specific SQL types for these commands. These changes provide improved functionality for managing and manipulating tables in Snowflake, making it easier for users to work with and modify their data. The new functionality has been tested using the `SnowflakeToDatabricksTranspilerTest` class, which specifies Snowflake `ALTER TABLE` commands and the expected transpiled results.
* Added support for `STRUCT` types and conversions ([#852](#852)). This change adds support for `STRUCT` types and conversions in the system by implementing new `StructType`, `StructField`, and `StructExpr` classes for parsing, data type inference, and code generation. It also maps the `OBJECT_CONSTRUCT` from Snowflake and introduces updates to various case classes such as `JsonExpr`, `Struct`, and `Star`. These improvements enhance the system's capability to handle complex data structures, ensuring better compatibility with external data sources and expanding the range of transformations available for users. Additionally, the changes include the addition of test cases to verify the functionality of generating SQL data types for `STRUCT` expressions and handling JSON literals more accurately.
* Minor upgrades to Snowflake parameter processing ([#871](#871)). This commit includes minor upgrades to Snowflake parameter processing, enhancing the consistency and readability of the code. The changes normalize parameter generation to use `${}` syntax for clarity and to align with Databricks notebook examples. An extra coverage test for variable references within strings has been added. The specific changes include updating a SELECT statement in a Snowflake SQL query to use ${} for parameter processing. The commit also introduces a new SQL file for functional tests related to Snowflake's parameter processing, which includes commented out and alternate syntax versions of a query. This commit is part of continuous efforts to improve the functionality, reliability, and usability of the Snowflake parameter processing feature.
* Patch/reconcile support temp views ([#901](#901)). The latest update to the remorph-reconcile library adds support for temporary views, a new feature that was not previously available. With this change, the system can now handle `global_temp` for temporary views by modifying the `_get_schema_query` method to return a query for the `global_temp` schema if the schema name is set as such. Additionally, the `read_data` method was updated to correctly handle the namespace and catalog for temporary views. The new variable `namespace_catalog` has been introduced, which is set to `hive_metastore` if the catalog is not set, and to the original catalog with the added schema otherwise. The `table_with_namespace` variable is then updated to use the `namespace_catalog` and table name, allowing for correct querying of temporary views. These modifications enable remorph-reconcile to work seamlessly with temporary views, enhancing its flexibility and functionality. The updated unit tests reflect these changes, with assertions to ensure that the correct SQL statements are being generated and executed for temporary views.
* Reconcile Table Recon JSON filename updates ([#866](#866)). The Remorph project has implemented a change to the naming convention and placement of the configuration file for the table reconciliation process. The configuration file, previously named according to individual preference, must now follow the pattern `recon_config_<DATA_SOURCE>_<SOURCE_CATALOG_OR_SCHEMA>_<REPORT_TYPE>.json` and be placed in the `.remorph` directory within the Databricks Workspace. Examples of Table Recon filenames for Snowflake, Oracle, and Databricks source systems have been provided for reference. Additionally, the `data_source` field in the config file has been updated to accurately reflect the data source. The case of the filename should now match the case of `SOURCE_CATALOG_OR_SCHEMA` as defined in the config. Compliance with this new naming convention and placement is required for the successful execution of the table reconciliation process.
* [snowflake] parse parameters ([#855](#855)). The open-source library has undergone changes related to Scalafmt configuration, Snowflake SQL parsing, and the introduction of a new `ExpressionGenerator` class method. The Scalafmt configuration change introduces a new `docstrings.wrap` option set to `false`, disabling docstring wrapping at the specified column limit. The `danglingParentheses.preset` option is also set to `false`, disabling the formatting rule for unnecessary parentheses. In Snowflake SQL parsing, new token types, lexer modes, and parser rules have been added to improve the parsing of string literals and other elements. A new `variable` method in the `ExpressionGenerator` class generates SQL expressions for `ir.Variable` objects. A new `Variable` case class has been added to represent a variable in an expression, and the `SchemaReference` case class now takes a single child expression. The `SnowflakeDDLBuilder` class has a new method, `extractString`, to safely extract strings from ANTLR4 context objects. The `SnowflakeErrorStrategy` object now includes new parameters for parsing Snowflake syntax, and the Snowflake LexerSpec test class has new methods for filling tokens from an input string and dumping the token list. Tests have been added for various string literal scenarios, and the SnowflakeAstBuilderSpec includes a new test case for handling the `translate amps` functionality. The Snowflake SQL queries in the test file have been updated to standardize parameter referencing syntax, improving consistency and readability.
* fixed current_date() generation ([#890](#890)). This release includes a fix for an issue with the generation of the `current_date()` function in SQL queries, specifically for the Snowflake dialect. A test case in the `sqlglot-incorrect` category has been updated to use the correct syntax for the `CURRENT_DATE` function, which includes parentheses (`SELECT CURRENT_DATE() FROM tabl;`). Additionally, the `current_date()` function is now called consistently throughout the tests, either as `CURRENT_DATE` or `CURRENT_DATE()`, depending on the syntax required by Snowflake. No new methods were added, and the existing functionality was changed only to correct the `current_date()` generation. This improvement ensures accurate and consistent generation of the `current_date()` function across different SQL dialects, enhancing the reliability and accuracy of the tests.
@nfx nfx mentioned this pull request Sep 16, 2024
nfx added a commit that referenced this pull request Sep 16, 2024
* Added query history retrieval from Snowflake
([#874](#874)). This
release introduces query history retrieval from Snowflake, enabling
expanded compatibility and data source options for the system. The
update includes adding the Snowflake JDBC driver and its dependencies to
the `pom.xml` file, and the implementation of a new
`SnowflakeQueryHistory` class to retrieve query history from Snowflake.
The `Anonymizer` object is also added to anonymize query histories by
fingerprinting queries based on their structure. Additionally, several
case classes are added to represent various types of data related to
query execution and table definitions in a Snowflake database. A new
`EnvGetter` class is also included to retrieve environment variables for
use in testing. Test files for the `Anonymizer` and
`SnowflakeQueryHistory` classes are added to ensure proper
functionality.
* Added support for `ALTER TABLE`: `ADD COLUMNS`, `DROP COLUMNS`,
`RENAME COLUMNS`, and `DROP CONSTRAINTS`
([#861](#861)). In this
release, support for various `ALTER TABLE` SQL commands has been added
to our open-source library, including `ADD COLUMNS`, `DROP COLUMNS`,
`RENAME COLUMNS`, and `DROP CONSTRAINTS`. These features have been
implemented in the `LogicalPlanGenerator` class, which now includes a
new private method `alterTable` that takes a context and an
`AlterTableCommand` object and returns an `ALTER TABLE` SQL statement.
Additionally, a new sealed trait `TableAlteration` has been introduced,
with four case classes extending it to handle specific table alteration
operations. The `SnowflakeTypeBuilder` class has also been updated to
parse and build Snowflake-specific SQL types for these commands. These
changes provide improved functionality for managing and manipulating
tables in Snowflake, making it easier for users to work with and modify
their data. The new functionality has been tested using the
`SnowflakeToDatabricksTranspilerTest` class, which specifies Snowflake
`ALTER TABLE` commands and the expected transpiled results.
* Added support for `STRUCT` types and conversions
([#852](#852)). This
change adds support for `STRUCT` types and conversions in the system by
implementing new `StructType`, `StructField`, and `StructExpr` classes
for parsing, data type inference, and code generation. It also maps the
`OBJECT_CONSTRUCT` from Snowflake and introduces updates to various case
classes such as `JsonExpr`, `Struct`, and `Star`. These improvements
enhance the system's capability to handle complex data structures,
ensuring better compatibility with external data sources and expanding
the range of transformations available for users. Additionally, the
changes include the addition of test cases to verify the functionality
of generating SQL data types for `STRUCT` expressions and handling JSON
literals more accurately.
* Minor upgrades to Snowflake parameter processing
([#871](#871)). This
commit includes minor upgrades to Snowflake parameter processing,
enhancing the consistency and readability of the code. The changes
normalize parameter generation to use `${}` syntax for clarity and to
align with Databricks notebook examples. An extra coverage test for
variable references within strings has been added. The specific changes
include updating a SELECT statement in a Snowflake SQL query to use ${}
for parameter processing. The commit also introduces a new SQL file for
functional tests related to Snowflake's parameter processing, which
includes commented out and alternate syntax versions of a query. This
commit is part of continuous efforts to improve the functionality,
reliability, and usability of the Snowflake parameter processing
feature.
* Patch/reconcile support temp views
([#901](#901)). The
latest update to the remorph-reconcile library adds support for
temporary views, a new feature that was not previously available. With
this change, the system can now handle `global_temp` for temporary views
by modifying the `_get_schema_query` method to return a query for the
`global_temp` schema if the schema name is set as such. Additionally,
the `read_data` method was updated to correctly handle the namespace and
catalog for temporary views. The new variable `namespace_catalog` has
been introduced, which is set to `hive_metastore` if the catalog is not
set, and to the original catalog with the added schema otherwise. The
`table_with_namespace` variable is then updated to use the
`namespace_catalog` and table name, allowing for correct querying of
temporary views. These modifications enable remorph-reconcile to work
seamlessly with temporary views, enhancing its flexibility and
functionality. The updated unit tests reflect these changes, with
assertions to ensure that the correct SQL statements are being generated
and executed for temporary views.
* Reconcile Table Recon JSON filename updates
([#866](#866)). The
Remorph project has implemented a change to the naming convention and
placement of the configuration file for the table reconciliation
process. The configuration file, previously named according to
individual preference, must now follow the pattern
`recon_config_<DATA_SOURCE>_<SOURCE_CATALOG_OR_SCHEMA>_<REPORT_TYPE>.json`
and be placed in the `.remorph` directory within the Databricks
Workspace. Examples of Table Recon filenames for Snowflake, Oracle, and
Databricks source systems have been provided for reference.
Additionally, the `data_source` field in the config file has been
updated to accurately reflect the data source. The case of the filename
should now match the case of `SOURCE_CATALOG_OR_SCHEMA` as defined in
the config. Compliance with this new naming convention and placement is
required for the successful execution of the table reconciliation
process.
* [snowflake] parse parameters
([#855](#855)). The
open-source library has undergone changes related to Scalafmt
configuration, Snowflake SQL parsing, and the introduction of a new
`ExpressionGenerator` class method. The Scalafmt configuration change
introduces a new `docstrings.wrap` option set to `false`, disabling
docstring wrapping at the specified column limit. The
`danglingParentheses.preset` option is also set to `false`, disabling
the formatting rule for unnecessary parentheses. In Snowflake SQL
parsing, new token types, lexer modes, and parser rules have been added
to improve the parsing of string literals and other elements. A new
`variable` method in the `ExpressionGenerator` class generates SQL
expressions for `ir.Variable` objects. A new `Variable` case class has
been added to represent a variable in an expression, and the
`SchemaReference` case class now takes a single child expression. The
`SnowflakeDDLBuilder` class has a new method, `extractString`, to safely
extract strings from ANTLR4 context objects. The
`SnowflakeErrorStrategy` object now includes new parameters for parsing
Snowflake syntax, and the Snowflake LexerSpec test class has new methods
for filling tokens from an input string and dumping the token list.
Tests have been added for various string literal scenarios, and the
SnowflakeAstBuilderSpec includes a new test case for handling the
`translate amps` functionality. The Snowflake SQL queries in the test
file have been updated to standardize parameter referencing syntax,
improving consistency and readability.
* fixed current_date() generation
([#890](#890)). This
release includes a fix for an issue with the generation of the
`current_date()` function in SQL queries, specifically for the Snowflake
dialect. A test case in the `sqlglot-incorrect` category has been
updated to use the correct syntax for the `CURRENT_DATE` function, which
includes parentheses (`SELECT CURRENT_DATE() FROM tabl;`). Additionally,
the `current_date()` function is now called consistently throughout the
tests, either as `CURRENT_DATE` or `CURRENT_DATE()`, depending on the
syntax required by Snowflake. No new methods were added, and the
existing functionality was changed only to correct the `current_date()`
generation. This improvement ensures accurate and consistent generation
of the `current_date()` function across different SQL dialects,
enhancing the reliability and accuracy of the tests.
sundarshankar89 pushed a commit to sundarshankar89/remorph that referenced this pull request Jan 2, 2025
* Added query history retrieval from Snowflake
([databrickslabs#874](databrickslabs#874)). This
release introduces query history retrieval from Snowflake, enabling
expanded compatibility and data source options for the system. The
update includes adding the Snowflake JDBC driver and its dependencies to
the `pom.xml` file, and the implementation of a new
`SnowflakeQueryHistory` class to retrieve query history from Snowflake.
The `Anonymizer` object is also added to anonymize query histories by
fingerprinting queries based on their structure. Additionally, several
case classes are added to represent various types of data related to
query execution and table definitions in a Snowflake database. A new
`EnvGetter` class is also included to retrieve environment variables for
use in testing. Test files for the `Anonymizer` and
`SnowflakeQueryHistory` classes are added to ensure proper
functionality.
* Added support for `ALTER TABLE`: `ADD COLUMNS`, `DROP COLUMNS`,
`RENAME COLUMNS`, and `DROP CONSTRAINTS`
([databrickslabs#861](databrickslabs#861)). In this
release, support for various `ALTER TABLE` SQL commands has been added
to our open-source library, including `ADD COLUMNS`, `DROP COLUMNS`,
`RENAME COLUMNS`, and `DROP CONSTRAINTS`. These features have been
implemented in the `LogicalPlanGenerator` class, which now includes a
new private method `alterTable` that takes a context and an
`AlterTableCommand` object and returns an `ALTER TABLE` SQL statement.
Additionally, a new sealed trait `TableAlteration` has been introduced,
with four case classes extending it to handle specific table alteration
operations. The `SnowflakeTypeBuilder` class has also been updated to
parse and build Snowflake-specific SQL types for these commands. These
changes provide improved functionality for managing and manipulating
tables in Snowflake, making it easier for users to work with and modify
their data. The new functionality has been tested using the
`SnowflakeToDatabricksTranspilerTest` class, which specifies Snowflake
`ALTER TABLE` commands and the expected transpiled results.
* Added support for `STRUCT` types and conversions
([databrickslabs#852](databrickslabs#852)). This
change adds support for `STRUCT` types and conversions in the system by
implementing new `StructType`, `StructField`, and `StructExpr` classes
for parsing, data type inference, and code generation. It also maps the
`OBJECT_CONSTRUCT` from Snowflake and introduces updates to various case
classes such as `JsonExpr`, `Struct`, and `Star`. These improvements
enhance the system's capability to handle complex data structures,
ensuring better compatibility with external data sources and expanding
the range of transformations available for users. Additionally, the
changes include the addition of test cases to verify the functionality
of generating SQL data types for `STRUCT` expressions and handling JSON
literals more accurately.
* Minor upgrades to Snowflake parameter processing
([databrickslabs#871](databrickslabs#871)). This
commit includes minor upgrades to Snowflake parameter processing,
enhancing the consistency and readability of the code. The changes
normalize parameter generation to use `${}` syntax for clarity and to
align with Databricks notebook examples. An extra coverage test for
variable references within strings has been added. The specific changes
include updating a SELECT statement in a Snowflake SQL query to use ${}
for parameter processing. The commit also introduces a new SQL file for
functional tests related to Snowflake's parameter processing, which
includes commented out and alternate syntax versions of a query. This
commit is part of continuous efforts to improve the functionality,
reliability, and usability of the Snowflake parameter processing
feature.
* Patch/reconcile support temp views
([databrickslabs#901](databrickslabs#901)). The
latest update to the remorph-reconcile library adds support for
temporary views, a new feature that was not previously available. With
this change, the system can now handle `global_temp` for temporary views
by modifying the `_get_schema_query` method to return a query for the
`global_temp` schema if the schema name is set as such. Additionally,
the `read_data` method was updated to correctly handle the namespace and
catalog for temporary views. The new variable `namespace_catalog` has
been introduced, which is set to `hive_metastore` if the catalog is not
set, and to the original catalog with the added schema otherwise. The
`table_with_namespace` variable is then updated to use the
`namespace_catalog` and table name, allowing for correct querying of
temporary views. These modifications enable remorph-reconcile to work
seamlessly with temporary views, enhancing its flexibility and
functionality. The updated unit tests reflect these changes, with
assertions to ensure that the correct SQL statements are being generated
and executed for temporary views.
* Reconcile Table Recon JSON filename updates
([databrickslabs#866](databrickslabs#866)). The
Remorph project has implemented a change to the naming convention and
placement of the configuration file for the table reconciliation
process. The configuration file, previously named according to
individual preference, must now follow the pattern
`recon_config_<DATA_SOURCE>_<SOURCE_CATALOG_OR_SCHEMA>_<REPORT_TYPE>.json`
and be placed in the `.remorph` directory within the Databricks
Workspace. Examples of Table Recon filenames for Snowflake, Oracle, and
Databricks source systems have been provided for reference.
Additionally, the `data_source` field in the config file has been
updated to accurately reflect the data source. The case of the filename
should now match the case of `SOURCE_CATALOG_OR_SCHEMA` as defined in
the config. Compliance with this new naming convention and placement is
required for the successful execution of the table reconciliation
process.
* [snowflake] parse parameters
([databrickslabs#855](databrickslabs#855)). The
open-source library has undergone changes related to Scalafmt
configuration, Snowflake SQL parsing, and the introduction of a new
`ExpressionGenerator` class method. The Scalafmt configuration change
introduces a new `docstrings.wrap` option set to `false`, disabling
docstring wrapping at the specified column limit. The
`danglingParentheses.preset` option is also set to `false`, disabling
the formatting rule for unnecessary parentheses. In Snowflake SQL
parsing, new token types, lexer modes, and parser rules have been added
to improve the parsing of string literals and other elements. A new
`variable` method in the `ExpressionGenerator` class generates SQL
expressions for `ir.Variable` objects. A new `Variable` case class has
been added to represent a variable in an expression, and the
`SchemaReference` case class now takes a single child expression. The
`SnowflakeDDLBuilder` class has a new method, `extractString`, to safely
extract strings from ANTLR4 context objects. The
`SnowflakeErrorStrategy` object now includes new parameters for parsing
Snowflake syntax, and the Snowflake LexerSpec test class has new methods
for filling tokens from an input string and dumping the token list.
Tests have been added for various string literal scenarios, and the
SnowflakeAstBuilderSpec includes a new test case for handling the
`translate amps` functionality. The Snowflake SQL queries in the test
file have been updated to standardize parameter referencing syntax,
improving consistency and readability.
* fixed current_date() generation
([databrickslabs#890](databrickslabs#890)). This
release includes a fix for an issue with the generation of the
`current_date()` function in SQL queries, specifically for the Snowflake
dialect. A test case in the `sqlglot-incorrect` category has been
updated to use the correct syntax for the `CURRENT_DATE` function, which
includes parentheses (`SELECT CURRENT_DATE() FROM tabl;`). Additionally,
the `current_date()` function is now called consistently throughout the
tests, either as `CURRENT_DATE` or `CURRENT_DATE()`, depending on the
syntax required by Snowflake. No new methods were added, and the
existing functionality was changed only to correct the `current_date()`
generation. This improvement ensures accurate and consistent generation
of the `current_date()` function across different SQL dialects,
enhancing the reliability and accuracy of the tests.
sundarshankar89 pushed a commit to sundarshankar89/remorph that referenced this pull request Jan 3, 2025
* Added query history retrieval from Snowflake
([databrickslabs#874](databrickslabs#874)). This
release introduces query history retrieval from Snowflake, enabling
expanded compatibility and data source options for the system. The
update includes adding the Snowflake JDBC driver and its dependencies to
the `pom.xml` file, and the implementation of a new
`SnowflakeQueryHistory` class to retrieve query history from Snowflake.
The `Anonymizer` object is also added to anonymize query histories by
fingerprinting queries based on their structure. Additionally, several
case classes are added to represent various types of data related to
query execution and table definitions in a Snowflake database. A new
`EnvGetter` class is also included to retrieve environment variables for
use in testing. Test files for the `Anonymizer` and
`SnowflakeQueryHistory` classes are added to ensure proper
functionality.
* Added support for `ALTER TABLE`: `ADD COLUMNS`, `DROP COLUMNS`,
`RENAME COLUMNS`, and `DROP CONSTRAINTS`
([databrickslabs#861](databrickslabs#861)). In this
release, support for various `ALTER TABLE` SQL commands has been added
to our open-source library, including `ADD COLUMNS`, `DROP COLUMNS`,
`RENAME COLUMNS`, and `DROP CONSTRAINTS`. These features have been
implemented in the `LogicalPlanGenerator` class, which now includes a
new private method `alterTable` that takes a context and an
`AlterTableCommand` object and returns an `ALTER TABLE` SQL statement.
Additionally, a new sealed trait `TableAlteration` has been introduced,
with four case classes extending it to handle specific table alteration
operations. The `SnowflakeTypeBuilder` class has also been updated to
parse and build Snowflake-specific SQL types for these commands. These
changes provide improved functionality for managing and manipulating
tables in Snowflake, making it easier for users to work with and modify
their data. The new functionality has been tested using the
`SnowflakeToDatabricksTranspilerTest` class, which specifies Snowflake
`ALTER TABLE` commands and the expected transpiled results.
* Added support for `STRUCT` types and conversions
([databrickslabs#852](databrickslabs#852)). This
change adds support for `STRUCT` types and conversions in the system by
implementing new `StructType`, `StructField`, and `StructExpr` classes
for parsing, data type inference, and code generation. It also maps the
`OBJECT_CONSTRUCT` from Snowflake and introduces updates to various case
classes such as `JsonExpr`, `Struct`, and `Star`. These improvements
enhance the system's capability to handle complex data structures,
ensuring better compatibility with external data sources and expanding
the range of transformations available for users. Additionally, the
changes include the addition of test cases to verify the functionality
of generating SQL data types for `STRUCT` expressions and handling JSON
literals more accurately.
* Minor upgrades to Snowflake parameter processing
([databrickslabs#871](databrickslabs#871)). This
commit includes minor upgrades to Snowflake parameter processing,
enhancing the consistency and readability of the code. The changes
normalize parameter generation to use `${}` syntax for clarity and to
align with Databricks notebook examples. An extra coverage test for
variable references within strings has been added. The specific changes
include updating a SELECT statement in a Snowflake SQL query to use ${}
for parameter processing. The commit also introduces a new SQL file for
functional tests related to Snowflake's parameter processing, which
includes commented out and alternate syntax versions of a query. This
commit is part of continuous efforts to improve the functionality,
reliability, and usability of the Snowflake parameter processing
feature.
* Patch/reconcile support temp views
([databrickslabs#901](databrickslabs#901)). The
latest update to the remorph-reconcile library adds support for
temporary views, a new feature that was not previously available. With
this change, the system can now handle `global_temp` for temporary views
by modifying the `_get_schema_query` method to return a query for the
`global_temp` schema if the schema name is set as such. Additionally,
the `read_data` method was updated to correctly handle the namespace and
catalog for temporary views. The new variable `namespace_catalog` has
been introduced, which is set to `hive_metastore` if the catalog is not
set, and to the original catalog with the added schema otherwise. The
`table_with_namespace` variable is then updated to use the
`namespace_catalog` and table name, allowing for correct querying of
temporary views. These modifications enable remorph-reconcile to work
seamlessly with temporary views, enhancing its flexibility and
functionality. The updated unit tests reflect these changes, with
assertions to ensure that the correct SQL statements are being generated
and executed for temporary views.
* Reconcile Table Recon JSON filename updates
([databrickslabs#866](databrickslabs#866)). The
Remorph project has implemented a change to the naming convention and
placement of the configuration file for the table reconciliation
process. The configuration file, previously named according to
individual preference, must now follow the pattern
`recon_config_<DATA_SOURCE>_<SOURCE_CATALOG_OR_SCHEMA>_<REPORT_TYPE>.json`
and be placed in the `.remorph` directory within the Databricks
Workspace. Examples of Table Recon filenames for Snowflake, Oracle, and
Databricks source systems have been provided for reference.
Additionally, the `data_source` field in the config file has been
updated to accurately reflect the data source. The case of the filename
should now match the case of `SOURCE_CATALOG_OR_SCHEMA` as defined in
the config. Compliance with this new naming convention and placement is
required for the successful execution of the table reconciliation
process.
* [snowflake] parse parameters
([databrickslabs#855](databrickslabs#855)). The
open-source library has undergone changes related to Scalafmt
configuration, Snowflake SQL parsing, and the introduction of a new
`ExpressionGenerator` class method. The Scalafmt configuration change
introduces a new `docstrings.wrap` option set to `false`, disabling
docstring wrapping at the specified column limit. The
`danglingParentheses.preset` option is also set to `false`, disabling
the formatting rule for unnecessary parentheses. In Snowflake SQL
parsing, new token types, lexer modes, and parser rules have been added
to improve the parsing of string literals and other elements. A new
`variable` method in the `ExpressionGenerator` class generates SQL
expressions for `ir.Variable` objects. A new `Variable` case class has
been added to represent a variable in an expression, and the
`SchemaReference` case class now takes a single child expression. The
`SnowflakeDDLBuilder` class has a new method, `extractString`, to safely
extract strings from ANTLR4 context objects. The
`SnowflakeErrorStrategy` object now includes new parameters for parsing
Snowflake syntax, and the Snowflake LexerSpec test class has new methods
for filling tokens from an input string and dumping the token list.
Tests have been added for various string literal scenarios, and the
SnowflakeAstBuilderSpec includes a new test case for handling the
`translate amps` functionality. The Snowflake SQL queries in the test
file have been updated to standardize parameter referencing syntax,
improving consistency and readability.
* fixed current_date() generation
([databrickslabs#890](databrickslabs#890)). This
release includes a fix for an issue with the generation of the
`current_date()` function in SQL queries, specifically for the Snowflake
dialect. A test case in the `sqlglot-incorrect` category has been
updated to use the correct syntax for the `CURRENT_DATE` function, which
includes parentheses (`SELECT CURRENT_DATE() FROM tabl;`). Additionally,
the `current_date()` function is now called consistently throughout the
tests, either as `CURRENT_DATE` or `CURRENT_DATE()`, depending on the
syntax required by Snowflake. No new methods were added, and the
existing functionality was changed only to correct the `current_date()`
generation. This improvement ensures accurate and consistent generation
of the `current_date()` function across different SQL dialects,
enhancing the reliability and accuracy of the tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant