<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Identity column in DLT using Python in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/identity-column-in-dlt-using-python/m-p/16839#M10941</link>
    <description>&lt;P&gt;Hi @Kory Skistad​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please find below the table schema definition to use in a python dlt pipeline. You can see it mentions the identity column definition. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@dlt.table(&lt;/P&gt;&lt;P&gt;  comment="Raw data on sales",&lt;/P&gt;&lt;P&gt;  schema="""&lt;/P&gt;&lt;P&gt;    customer_id STRING,&lt;/P&gt;&lt;P&gt;    customer_name STRING,&lt;/P&gt;&lt;P&gt;    number_of_line_items STRING,&lt;/P&gt;&lt;P&gt;    order_datetime STRING,&lt;/P&gt;&lt;P&gt;    order_number LONG,&lt;/P&gt;&lt;P&gt;    order_day_of_week STRING GENERATED ALWAYS AS (dayofweek(order_datetime))&lt;/P&gt;&lt;P&gt;    """,&lt;/P&gt;&lt;P&gt;  partition_cols = ["order_day_of_week"])&lt;/P&gt;&lt;P&gt;def sales():&lt;/P&gt;&lt;P&gt;  return ("...")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This example has been taken from this page: &lt;A href="https://docs.databricks.com/workflows/delta-live-tables/delta-live-tables-python-ref.html" target="test_blank"&gt;https://docs.databricks.com/workflows/delta-live-tables/delta-live-tables-python-ref.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By the way, be careful about how it is generated regarding you are dealing with a streaming table or not: &lt;A href="https://docs.databricks.com/workflows/delta-live-tables/delta-live-tables-faqs-issues.html#how-do-i-use-identity-columns-when-creating-live-tables-with-sql" target="test_blank"&gt;https://docs.databricks.com/workflows/delta-live-tables/delta-live-tables-faqs-issues.html#how-do-i-use-identity-columns-when-creating-live-tables-with-sql&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH&lt;/P&gt;&lt;P&gt;Laurent&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 15 Dec 2022 11:12:50 GMT</pubDate>
    <dc:creator>LaurentLeturgez</dc:creator>
    <dc:date>2022-12-15T11:12:50Z</dc:date>
    <item>
      <title>Identity column in DLT using Python</title>
      <link>https://community.databricks.com/t5/data-engineering/identity-column-in-dlt-using-python/m-p/16838#M10940</link>
      <description>&lt;P&gt;How would I implement the Identity column in Delta Live Tables using Python syntax?&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY [ ( [ START WITH start ] [ INCREMENT BY step ] ) ]&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;B&gt;&amp;nbsp;&lt;/B&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2022 01:31:27 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/identity-column-in-dlt-using-python/m-p/16838#M10940</guid>
      <dc:creator>kskistad</dc:creator>
      <dc:date>2022-12-15T01:31:27Z</dc:date>
    </item>
    <item>
      <title>Re: Identity column in DLT using Python</title>
      <link>https://community.databricks.com/t5/data-engineering/identity-column-in-dlt-using-python/m-p/16839#M10941</link>
      <description>&lt;P&gt;Hi @Kory Skistad​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please find below the table schema definition to use in a python dlt pipeline. You can see it mentions the identity column definition. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@dlt.table(&lt;/P&gt;&lt;P&gt;  comment="Raw data on sales",&lt;/P&gt;&lt;P&gt;  schema="""&lt;/P&gt;&lt;P&gt;    customer_id STRING,&lt;/P&gt;&lt;P&gt;    customer_name STRING,&lt;/P&gt;&lt;P&gt;    number_of_line_items STRING,&lt;/P&gt;&lt;P&gt;    order_datetime STRING,&lt;/P&gt;&lt;P&gt;    order_number LONG,&lt;/P&gt;&lt;P&gt;    order_day_of_week STRING GENERATED ALWAYS AS (dayofweek(order_datetime))&lt;/P&gt;&lt;P&gt;    """,&lt;/P&gt;&lt;P&gt;  partition_cols = ["order_day_of_week"])&lt;/P&gt;&lt;P&gt;def sales():&lt;/P&gt;&lt;P&gt;  return ("...")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This example has been taken from this page: &lt;A href="https://docs.databricks.com/workflows/delta-live-tables/delta-live-tables-python-ref.html" target="test_blank"&gt;https://docs.databricks.com/workflows/delta-live-tables/delta-live-tables-python-ref.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By the way, be careful about how it is generated regarding you are dealing with a streaming table or not: &lt;A href="https://docs.databricks.com/workflows/delta-live-tables/delta-live-tables-faqs-issues.html#how-do-i-use-identity-columns-when-creating-live-tables-with-sql" target="test_blank"&gt;https://docs.databricks.com/workflows/delta-live-tables/delta-live-tables-faqs-issues.html#how-do-i-use-identity-columns-when-creating-live-tables-with-sql&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH&lt;/P&gt;&lt;P&gt;Laurent&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2022 11:12:50 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/identity-column-in-dlt-using-python/m-p/16839#M10941</guid>
      <dc:creator>LaurentLeturgez</dc:creator>
      <dc:date>2022-12-15T11:12:50Z</dc:date>
    </item>
  </channel>
</rss>

