Databricks JDBC write to table with PK column, error, key not found.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2024 07:32 AM - edited 06-25-2024 07:52 AM
Hello, I am trying to write data to table, it works find before, but after I recreated the table with one column as PK, there is an error.
Unable to write into the A_Table table....key not found: id
What is the correct way of doing this?
PK column: [ID] [bigint] IDENTITY(1,1) PRIMARY KEY NOT NULL
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-01-2025 03:31 AM
Looks like the primary key column ID is not being found during the write operation.
Kindly verify the schema.
Use a command like below to create the table with id as the primary key.
CREATE TABLE A_Table ( ID BIGINT IDENTITY(1,1) PRIMARY KEY NOT NULL, -- other columns );
Documentations:
https://docs.databricks.com/ja/sql/language-manual/sql-ref-syntax-ddl-create-table-using.html
https://docs.databricks.com/ja/sql/language-manual/sql-ref-syntax-ddl-create-table-constraint.html