cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Error while creating delta table with partitions

Faisal
Contributor

Hi All,

I am unable to create delta table with partitioning option, can someone please correct me what I am missing and help me with updated query

 

 

CREATE OR REPLACE TABLE invoice 
USING DELTA 
PARTITION BY (year(shp_dt), month(shp_dt)) 
LOCATION '/tables/invoice' 
AS
SELECT
  *,
  current_timestamp() as adls_load_timestamp
FROM
  hive_metastore.invoice_edw 
WHERE 
  shp_dt between '2023-01-01' and '2023-12-31';
โ€‹

Error in SQL statement: ParseException: 
[PARSE_SYNTAX_ERROR] Syntax error at or near 'PARTITION'.(line 2, pos 55)

 

 

 
1 ACCEPTED SOLUTION

Accepted Solutions

Kaniz_Fatma
Community Manager
Community Manager

Hi @Faisal ,  Use the PARTITIONED BY clause instead of the PARTITION BY clause.

View solution in original post

3 REPLIES 3

Emil_Kaminski
Contributor

Hi,

PARTITION -> PARTITIONED

Good Luck

** You might also want to subscribe to Warsaw Databricks YT channel: https://www.youtube.com/channel/UC1-u_2nI97cNHtu_FQ3HP_A

Kaniz_Fatma
Community Manager
Community Manager

Hi @Faisal ,  Use the PARTITIONED BY clause instead of the PARTITION BY clause.

Emil_Kaminski
Contributor

@Kaniz_Fatma Hi. Is that not exactly what I suggested before? Sorry for stupid questions, but I am learning rules or earning kudos and getting solutions approved, therefore suggestions from your end would be appreciated. Thank you.

** You might also want to subscribe to Warsaw Databricks YT channel: https://www.youtube.com/channel/UC1-u_2nI97cNHtu_FQ3HP_A
Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!