Skip to content

Instantly share code, notes, and snippets.

@jeanmidevacc
Last active August 26, 2025 03:25
Show Gist options
  • Save jeanmidevacc/1d60e57c82ff4a5505e174e6d225f8b0 to your computer and use it in GitHub Desktop.
Save jeanmidevacc/1d60e57c82ff4a5505e174e6d225f8b0 to your computer and use it in GitHub Desktop.
Sample of code to build and write on liquid clustered table
# Add a create stement example
# build a table
query = """
CREATE TABLE IF NOT EXISTS name_of_the_table (
column_1 DATE,
column_2 INT,
p_dateid INT NOT NULL
)
USING DELTA
CLUSTER BY (p_dateid); # you could also set CLUSTER BY AUTO , if you wanto let databrciks handle the rest
"""
# Add an insert into table , replace cmd
query = """
INSERT INTO TABLE name_of_the_table
SELECT * FROM data_to_add
REPLACE WHERE p_dateid BETWEEN {start_dateid} AND {end_dateid}
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment