<?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: Arcpy String field getting set to None instead of Null in Python Snippets Questions</title>
    <link>https://community.esri.com/t5/python-snippets-questions/arcpy-string-field-getting-set-to-none-instead-of/m-p/838942#M479</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;None&lt;/STRONG&gt; is more or less the Python equivalent of NULL in a database. You are writing Python code, not SQL, here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unless you are executing SQL through ODBC with something like &lt;A href="https://github.com/mkleehammer/pyodbc/wiki"&gt;pyodbc&lt;/A&gt;, and emmitting queries like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;lt;FIELD&amp;gt; IS NULL&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you generally would only use None in Python code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to insert empty strings instead of None, you could simply use&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;row[0]=''&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Apr 2020 09:09:22 GMT</pubDate>
    <dc:creator>MarcoBoeringa</dc:creator>
    <dc:date>2020-04-16T09:09:22Z</dc:date>
    <item>
      <title>Arcpy String field getting set to None instead of Null</title>
      <link>https://community.esri.com/t5/python-snippets-questions/arcpy-string-field-getting-set-to-none-instead-of/m-p/838941#M478</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The code given below is setting value of the field as 'None' instead of Null?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcpy&lt;BR /&gt;fc = 'c:/data/base.gdb/well'&lt;BR /&gt;fields = ['Name']&lt;BR /&gt;with arcpy.da.UpdateCursor(fc, fields) as cursor:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; for row in cursor:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; row[0] = None&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cursor.updateRow(row)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;arcmap version 10.2&lt;/P&gt;&lt;P&gt;I need to set these string values to null ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Apr 2020 07:25:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/arcpy-string-field-getting-set-to-none-instead-of/m-p/838941#M478</guid>
      <dc:creator>RAHULPANDIA</dc:creator>
      <dc:date>2020-04-16T07:25:14Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy String field getting set to None instead of Null</title>
      <link>https://community.esri.com/t5/python-snippets-questions/arcpy-string-field-getting-set-to-none-instead-of/m-p/838942#M479</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;None&lt;/STRONG&gt; is more or less the Python equivalent of NULL in a database. You are writing Python code, not SQL, here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unless you are executing SQL through ODBC with something like &lt;A href="https://github.com/mkleehammer/pyodbc/wiki"&gt;pyodbc&lt;/A&gt;, and emmitting queries like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;lt;FIELD&amp;gt; IS NULL&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you generally would only use None in Python code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to insert empty strings instead of None, you could simply use&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;row[0]=''&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Apr 2020 09:09:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/arcpy-string-field-getting-set-to-none-instead-of/m-p/838942#M479</guid>
      <dc:creator>MarcoBoeringa</dc:creator>
      <dc:date>2020-04-16T09:09:22Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy String field getting set to None instead of Null</title>
      <link>https://community.esri.com/t5/python-snippets-questions/arcpy-string-field-getting-set-to-none-instead-of/m-p/838943#M480</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I know i can set this to ''....but&amp;nbsp; need it to set to nul...not None not ''...anyidea how to do it?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Apr 2020 10:14:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/arcpy-string-field-getting-set-to-none-instead-of/m-p/838943#M480</guid>
      <dc:creator>RAHULPANDIA</dc:creator>
      <dc:date>2020-04-16T10:14:07Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy String field getting set to None instead of Null</title>
      <link>https://community.esri.com/t5/python-snippets-questions/arcpy-string-field-getting-set-to-none-instead-of/m-p/838944#M481</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try indenting updaterow by one level as in the code examples here&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/arcpy/data-access/updatecursor-class.htm" title="https://pro.arcgis.com/en/pro-app/arcpy/data-access/updatecursor-class.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;UpdateCursor—Data Access module | Documentation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;with&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;da&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;UpdateCursor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; fields&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; cursor&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; row &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; cursor&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; None
        cursor&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;updateRow&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;row&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 10:13:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/arcpy-string-field-getting-set-to-none-instead-of/m-p/838944#M481</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-12T10:13:27Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy String field getting set to None instead of Null</title>
      <link>https://community.esri.com/t5/python-snippets-questions/arcpy-string-field-getting-set-to-none-instead-of/m-p/838945#M482</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you are working with a File Geodatabase, like you do, then setting NULL &lt;EM&gt;means using &lt;STRONG&gt;None&lt;/STRONG&gt; in Python&lt;/EM&gt;, there is no NULL concept for setting values in a File Geodatabase to None / NULL, you should use &lt;STRONG&gt;None&lt;/STRONG&gt; instead as in the code example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Remember: You are writing &lt;STRONG&gt;Python&lt;/STRONG&gt; code here, which is &lt;EM&gt;not&lt;/EM&gt; the same as defining SQL statements for use in ODBC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are working with an Enterprise Geodatabase and writing DML SQL statements and sending them through e.g. ODBC, then yes, you can set the values to NULL,&lt;EM&gt; in a DML SQL statement&lt;/EM&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Apr 2020 12:41:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/arcpy-string-field-getting-set-to-none-instead-of/m-p/838945#M482</guid>
      <dc:creator>MarcoBoeringa</dc:creator>
      <dc:date>2020-04-16T12:41:41Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy String field getting set to None instead of Null</title>
      <link>https://community.esri.com/t5/python-snippets-questions/arcpy-string-field-getting-set-to-none-instead-of/m-p/838946#M483</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Make sure the field allows NULL.&amp;nbsp; It could be that ArcGIS is converting None to 'None' if NULL is not allowed in the field.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Apr 2020 15:08:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/arcpy-string-field-getting-set-to-none-instead-of/m-p/838946#M483</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2020-04-16T15:08:17Z</dc:date>
    </item>
  </channel>
</rss>

