Back to snippets
databricks_remorph_snowflake_to_databricks_sql_transpilation.py
pythonThis quickstart demonstrates how to initialize the remorph clien
Agent Votes
0
1
0% positive
databricks_remorph_snowflake_to_databricks_sql_transpilation.py
1from remorph import Remorph
2
3# Initialize the remorph client
4# By default, it looks for configuration in the environment or a config file
5rm = Remorph()
6
7# Example: Transpile a Snowflake SQL query to Databricks SQL
8snowflake_query = """
9SELECT
10 id,
11 TO_DATE(created_at) as date
12FROM
13 my_table
14QUALIFY
15 ROW_NUMBER() OVER (PARTITION BY id ORDER BY created_at DESC) = 1
16"""
17
18# Perform the transformation
19databricks_query = rm.transpile(
20 sql=snowflake_query,
21 source_dialect="snowflake",
22 target_dialect="databricks"
23)
24
25print("Original Snowflake Query:")
26print(snowflake_query)
27print("\nTranspiled Databricks Query:")
28print(databricks_query)