Delta table definition - Identity column
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2023 09:03 AM
Hello,
Would anyone know if it is possible to create a delta table using Python that includes a column that is generated by default as identity (identity column for which the value inserted can be manually overriden)?
There seems to be a way to create an identity column using Python (through Delta Lake api, using the DeltaTableBuilder) that is generated always as identity (using option "generatedAlwaysAs") but I havent found the equivalent "generatedByDefaultAs" option).
So far, the only way I've found in order to create a column that is generated by default as identity is through Spark SQL.
thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2024 09:29 AM
Hi @oleprince ,
As far as I know, it's not possible yet to create tables with Identity columns using pyspark (DeltaTable api). You can create generated columns, but Identity columns are not allowed.
The only way to achieve this is through Spark Sql.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2025 05:39 AM
There is a `generatedByDefaultAs` option now, see https://github.com/delta-io/delta/pull/3404.