cancel
Showing results for 
Search instead for 
Did you mean: 
Community Platform Discussions
Connect with fellow community members to discuss general topics related to the Databricks platform, industry trends, and best practices. Share experiences, ask questions, and foster collaboration within the community.
cancel
Showing results for 
Search instead for 
Did you mean: 

Delta table definition - Identity column

oleprince
New Contributor

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 

1 REPLY 1

gmiguel
Contributor

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.

 

 

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group