<?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: Is it better to use Pandas/SQLAlchemy or Arcpy/SDE to retrieve data from MSSQL Server? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/is-it-better-to-use-pandas-sqlalchemy-or-arcpy-sde/m-p/1656686#M74772</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/77685"&gt;@AustinAverill&lt;/a&gt;&amp;nbsp;- it's a bit of 'it depends'. Are you planning on read only access or read/write? Do you plan to use spatial functions on the data?&lt;/P&gt;</description>
    <pubDate>Thu, 09 Oct 2025 15:23:12 GMT</pubDate>
    <dc:creator>ChristianWells</dc:creator>
    <dc:date>2025-10-09T15:23:12Z</dc:date>
    <item>
      <title>Is it better to use Pandas/SQLAlchemy or Arcpy/SDE to retrieve data from MSSQL Server?</title>
      <link>https://community.esri.com/t5/python-questions/is-it-better-to-use-pandas-sqlalchemy-or-arcpy-sde/m-p/1656676#M74771</link>
      <description>&lt;P&gt;Assuming scripts are being run through a machine that has valid SDE connections made, what is the best way to access data on the applicable server?&lt;/P&gt;&lt;PRE&gt;#SDE and SearchCursor
import arcpy

db_table = r'C:\DBCon.sde\table_name'
data = []

with arcpy.da.SearchCursor(db_table, fields) as cursor:
    for row in cursor:
        data.append(row)

df = pd.DataFrame(data, columns = fields)&lt;/PRE&gt;&lt;P&gt;or&lt;/P&gt;&lt;PRE&gt;#pandas and sql alchemy
data = []
&amp;nbsp; &amp;nbsp; 
for chunk in pd.read_sql_query(
&amp;nbsp; &amp;nbsp; query, connection,
&amp;nbsp; &amp;nbsp; chunksize=2000):
&amp;nbsp; &amp;nbsp; data.append(chunk)

df = pd.concat(data, ignore_index=True)&lt;/PRE&gt;</description>
      <pubDate>Thu, 09 Oct 2025 14:57:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/is-it-better-to-use-pandas-sqlalchemy-or-arcpy-sde/m-p/1656676#M74771</guid>
      <dc:creator>AustinAverill</dc:creator>
      <dc:date>2025-10-09T14:57:25Z</dc:date>
    </item>
    <item>
      <title>Re: Is it better to use Pandas/SQLAlchemy or Arcpy/SDE to retrieve data from MSSQL Server?</title>
      <link>https://community.esri.com/t5/python-questions/is-it-better-to-use-pandas-sqlalchemy-or-arcpy-sde/m-p/1656686#M74772</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/77685"&gt;@AustinAverill&lt;/a&gt;&amp;nbsp;- it's a bit of 'it depends'. Are you planning on read only access or read/write? Do you plan to use spatial functions on the data?&lt;/P&gt;</description>
      <pubDate>Thu, 09 Oct 2025 15:23:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/is-it-better-to-use-pandas-sqlalchemy-or-arcpy-sde/m-p/1656686#M74772</guid>
      <dc:creator>ChristianWells</dc:creator>
      <dc:date>2025-10-09T15:23:12Z</dc:date>
    </item>
    <item>
      <title>Re: Is it better to use Pandas/SQLAlchemy or Arcpy/SDE to retrieve data from MSSQL Server?</title>
      <link>https://community.esri.com/t5/python-questions/is-it-better-to-use-pandas-sqlalchemy-or-arcpy-sde/m-p/1656688#M74773</link>
      <description>&lt;P&gt;In the current workflow I have generated, the dataset is read from the server table (non-spatial) and produces a spatially enabled data frame from a column in the table that contains a geojson like string then truncates and updates an existing dataset with the new.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Oct 2025 15:26:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/is-it-better-to-use-pandas-sqlalchemy-or-arcpy-sde/m-p/1656688#M74773</guid>
      <dc:creator>AustinAverill</dc:creator>
      <dc:date>2025-10-09T15:26:31Z</dc:date>
    </item>
    <item>
      <title>Re: Is it better to use Pandas/SQLAlchemy or Arcpy/SDE to retrieve data from MSSQL Server?</title>
      <link>https://community.esri.com/t5/python-questions/is-it-better-to-use-pandas-sqlalchemy-or-arcpy-sde/m-p/1656691#M74774</link>
      <description>&lt;P&gt;Thank you! If the dataset being updated is in a geodatabase-enabled MSSQL Sever instance, I'd encourage you to use the arcpy.da functions for better geometry validation on the insert command.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Oct 2025 15:31:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/is-it-better-to-use-pandas-sqlalchemy-or-arcpy-sde/m-p/1656691#M74774</guid>
      <dc:creator>ChristianWells</dc:creator>
      <dc:date>2025-10-09T15:31:36Z</dc:date>
    </item>
    <item>
      <title>Re: Is it better to use Pandas/SQLAlchemy or Arcpy/SDE to retrieve data from MSSQL Server?</title>
      <link>https://community.esri.com/t5/python-questions/is-it-better-to-use-pandas-sqlalchemy-or-arcpy-sde/m-p/1656736#M74775</link>
      <description>&lt;P&gt;If your table is maintained outside of ArcGIS then direct connections work perfectly fine and avoid any ArcGIS overhead. But if the table was created in ArcGIS then you'll want to use an arcpy cursor to work with the data. You can use direct SQL connections but you have to take steps to ensure you're only reading the correct data from the table -- is it branch versioned, traditional versioned, archive table etc. etc. -- and writing data is far more complex and considered unsupported behavior so don't expect any support there.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Oct 2025 16:29:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/is-it-better-to-use-pandas-sqlalchemy-or-arcpy-sde/m-p/1656736#M74775</guid>
      <dc:creator>DavidSolari</dc:creator>
      <dc:date>2025-10-09T16:29:20Z</dc:date>
    </item>
  </channel>
</rss>

