cancel
Showing results for 
Search instead for 
Did you mean: 
Get Started Discussions
Start your journey with Databricks by joining discussions on getting started guides, tutorials, and introductory topics. Connect with beginners and experts alike to kickstart your Databricks experience.
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.

 

 

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local community—sign up today to get started!

Sign Up Now