<?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 Create delta table with space in  field names per source CSV file in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/create-delta-table-with-space-in-field-names-per-source-csv-file/m-p/103251#M41380</link>
    <description>&lt;P&gt;There are few fields in the source CSV file which has spaces in the field names. When I tried to create the table like &lt;STRONG&gt;`SOURCE 1 NAME` as string&lt;/STRONG&gt; for few fields, I got an error message like 'INVALID_COLUMN_NAME_AS_PATH' error.&amp;nbsp; Runtime version is 10.2 and above.&lt;/P&gt;&lt;P&gt;I'd like to know how to retain the space in the field names while creating delta table? I was asked not to rename the field names and the field names should be as it was in CSV file.&lt;/P&gt;&lt;P&gt;If the solution is like below, I'm not certain how to do this before I create the table.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;  ALTER TABLE &amp;lt;table_name&amp;gt; SET TBLPROPERTIES (
    'delta.minReaderVersion' = '2',
    'delta.minWriterVersion' = '5',
    'delta.columnMapping.mode' = 'name'
  )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 26 Dec 2024 17:57:06 GMT</pubDate>
    <dc:creator>David_Billa</dc:creator>
    <dc:date>2024-12-26T17:57:06Z</dc:date>
    <item>
      <title>Create delta table with space in  field names per source CSV file</title>
      <link>https://community.databricks.com/t5/data-engineering/create-delta-table-with-space-in-field-names-per-source-csv-file/m-p/103251#M41380</link>
      <description>&lt;P&gt;There are few fields in the source CSV file which has spaces in the field names. When I tried to create the table like &lt;STRONG&gt;`SOURCE 1 NAME` as string&lt;/STRONG&gt; for few fields, I got an error message like 'INVALID_COLUMN_NAME_AS_PATH' error.&amp;nbsp; Runtime version is 10.2 and above.&lt;/P&gt;&lt;P&gt;I'd like to know how to retain the space in the field names while creating delta table? I was asked not to rename the field names and the field names should be as it was in CSV file.&lt;/P&gt;&lt;P&gt;If the solution is like below, I'm not certain how to do this before I create the table.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;  ALTER TABLE &amp;lt;table_name&amp;gt; SET TBLPROPERTIES (
    'delta.minReaderVersion' = '2',
    'delta.minWriterVersion' = '5',
    'delta.columnMapping.mode' = 'name'
  )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Dec 2024 17:57:06 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/create-delta-table-with-space-in-field-names-per-source-csv-file/m-p/103251#M41380</guid>
      <dc:creator>David_Billa</dc:creator>
      <dc:date>2024-12-26T17:57:06Z</dc:date>
    </item>
    <item>
      <title>Re: Create delta table with space in  field names per source CSV file</title>
      <link>https://community.databricks.com/t5/data-engineering/create-delta-table-with-space-in-field-names-per-source-csv-file/m-p/103272#M41391</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/110498"&gt;@David_Billa&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Before ingesting the csv data into the delta table, you could create delta table using the table properties as shown below:&lt;/P&gt;&lt;LI-CODE lang="php"&gt;CREATE TABLE catalog_name.schema_name.table_name (`a` string, `b c` string)
TBLPROPERTIES (
    'delta.minReaderVersion' = '2',
    'delta.minWriterVersion' = '5',
    'delta.columnMapping.mode' = 'name'
  )&lt;/LI-CODE&gt;&lt;P&gt;Note: I've created a column `b c` with space between &amp;nbsp;them.&lt;BR /&gt;Later, I was able to add few more columns using alter table statement&lt;/P&gt;&lt;LI-CODE lang="php"&gt;ALTER TABLE
  catalog_name.schema_name.table_name
ADD COLUMNS (
  `SOURCE 1 NAME` string, `SOURCE 2 NAME` string
)&lt;/LI-CODE&gt;&lt;P&gt;** Important: One thing I notice is you're on DBR version 10.2 which might not support column mapping mode.&lt;BR /&gt;&lt;A href="https://learn.microsoft.com/en-us/azure/databricks/delta/column-mapping" target="_self"&gt;This Databricks Documentation&lt;/A&gt; mentions that column mapping is enabled for DBX runtime 10.4 LTS or above.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RiyazAli_0-1735267458040.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/13716i6EAD72E41AC0B00C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RiyazAli_0-1735267458040.png" alt="RiyazAli_0-1735267458040.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know your further thoughts.&lt;/P&gt;&lt;P&gt;Cheers!&lt;/P&gt;</description>
      <pubDate>Fri, 27 Dec 2024 02:44:28 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/create-delta-table-with-space-in-field-names-per-source-csv-file/m-p/103272#M41391</guid>
      <dc:creator>RiyazAliM</dc:creator>
      <dc:date>2024-12-27T02:44:28Z</dc:date>
    </item>
  </channel>
</rss>

