<?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: Advice/help needed in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/advice-help-needed/m-p/359890#M28380</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;After you get your data from your source, I think the easiest next step would be to use an insert cursor. Either directly into your SDE feature class or into a temp in memory feature class to then upload to SDE. &lt;BR /&gt;&lt;BR /&gt;See the last example in this help page for inserting geometry. It is a little easier than depicted since you are only inserting point geometry.&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//018w0000000t000000"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//018w0000000t000000&lt;/A&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;@mzcoyle thanks for your respond.&amp;nbsp; But what if the query result is from a stand alone non-spatial sql server that is from a different server?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 18 Oct 2013 17:19:40 GMT</pubDate>
    <dc:creator>TateM</dc:creator>
    <dc:date>2013-10-18T17:19:40Z</dc:date>
    <item>
      <title>Advice/help needed</title>
      <link>https://community.esri.com/t5/python-questions/advice-help-needed/m-p/359887#M28377</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello All,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would like y'all advice and help, as I'm still new at this. What I'm trying to do is to create a python script that go to a particular SQL Server grab the data --&amp;gt; then using arcpy create a point feature class --&amp;gt; then puts in a SDE Geodatabase (different server).&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Steps:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1. import pyodbc to connect to the SQL Server, query out the data.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. use Arcpy to create point feature class.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3. connect to SDE Geodatabase in a different Server then copy the point feature class into the Geodatabase.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This workflow seems to be correct? Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 05 Oct 2013 21:20:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/advice-help-needed/m-p/359887#M28377</guid>
      <dc:creator>TateM</dc:creator>
      <dc:date>2013-10-05T21:20:22Z</dc:date>
    </item>
    <item>
      <title>Re: Advice/help needed</title>
      <link>https://community.esri.com/t5/python-questions/advice-help-needed/m-p/359888#M28378</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;so far I got this is what I've got.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; 
import pyodbc, arcpy
cnxn = pyodbc.connect(trusted_connection='yes', driver='(SQL Server)', server = 'abcserver', database='TEST')
cursor = cnxn.cursor()
try:
&amp;nbsp;&amp;nbsp;&amp;nbsp; query = " SELECT surflat, surflong FROM table1
&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.execute(query)
&amp;nbsp;&amp;nbsp;&amp;nbsp; cnxn.commit()
except:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "error"
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And I think the next step is to use the&amp;nbsp; arcpy.MakeXYEventLayer_management --&amp;gt; arcpy.CopyFeatures_management into the SDE database.&amp;nbsp; Any pointers on how to do this?&amp;nbsp; TIA&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:47:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/advice-help-needed/m-p/359888#M28378</guid>
      <dc:creator>TateM</dc:creator>
      <dc:date>2021-12-11T16:47:19Z</dc:date>
    </item>
    <item>
      <title>Re: Advice/help needed</title>
      <link>https://community.esri.com/t5/python-questions/advice-help-needed/m-p/359889#M28379</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;After you get your data from your source, I think the easiest next step would be to use an insert cursor. Either directly into your SDE feature class or into a temp in memory feature class to then upload to SDE. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;See the last example in this help page for inserting geometry. It is a little easier than depicted since you are only inserting point geometry.&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//018w0000000t000000"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//018w0000000t000000&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Oct 2013 13:24:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/advice-help-needed/m-p/359889#M28379</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2013-10-08T13:24:51Z</dc:date>
    </item>
    <item>
      <title>Re: Advice/help needed</title>
      <link>https://community.esri.com/t5/python-questions/advice-help-needed/m-p/359890#M28380</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;After you get your data from your source, I think the easiest next step would be to use an insert cursor. Either directly into your SDE feature class or into a temp in memory feature class to then upload to SDE. &lt;BR /&gt;&lt;BR /&gt;See the last example in this help page for inserting geometry. It is a little easier than depicted since you are only inserting point geometry.&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//018w0000000t000000"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//018w0000000t000000&lt;/A&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;@mzcoyle thanks for your respond.&amp;nbsp; But what if the query result is from a stand alone non-spatial sql server that is from a different server?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Oct 2013 17:19:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/advice-help-needed/m-p/359890#M28380</guid>
      <dc:creator>TateM</dc:creator>
      <dc:date>2013-10-18T17:19:40Z</dc:date>
    </item>
    <item>
      <title>Re: Advice/help needed</title>
      <link>https://community.esri.com/t5/python-questions/advice-help-needed/m-p/359891#M28381</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello. Your workflow should work just fine. One thing I would recommend is setting up OLE DB Connections in ArcCatalog for your SQL Server connections. Define the Provider as SQL server and then select your server name, credentials, and database you are reading data from in your script. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For your workflow you should be able to simply Make XY event layer from your SQL table (e.g. name it "SQL_XY")and then use the Copy features GP tool. The input features for the tool would be your new "SQL_XY" table and the output feature class would be the SDE feature class you want to export the data to (just ensure that you have also setup a spatial database connection in Catalog to the SDE database) . See attached code and ModelBuilder workflow for an example. Good luck!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Tara&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Oct 2013 18:15:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/advice-help-needed/m-p/359891#M28381</guid>
      <dc:creator>City_of_RockfordIL</dc:creator>
      <dc:date>2013-10-18T18:15:06Z</dc:date>
    </item>
    <item>
      <title>Re: Advice/help needed</title>
      <link>https://community.esri.com/t5/python-questions/advice-help-needed/m-p/359892#M28382</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hello. Your workflow should work just fine. One thing I would recommend is setting up OLE DB Connections in ArcCatalog for your SQL Server connections. Define the Provider as SQL server and then select your server name, credentials, and database you are reading data from in your script. &lt;BR /&gt;&lt;BR /&gt;For your workflow you should be able to simply Make XY event layer from your SQL table (e.g. name it "SQL_XY")and then use the Copy features GP tool. The input features for the tool would be your new "SQL_XY" table and the output feature class would be the SDE feature class you want to export the data to (just ensure that you have also setup a spatial database connection in Catalog to the SDE database) . See attached code and ModelBuilder workflow for an example. Good luck!&lt;BR /&gt;&lt;BR /&gt;Tara&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks Tara, I have look at your workflow and it works, but what if I wanted to input a sql expression to filter it or have multiple tables and do a inner join for those tables and then use the XYEvent Layer. Do I create a stand-alone sql expression, what about the Make Query Table tool or Make Table View tool?&amp;nbsp; TIA.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 19 Oct 2013 02:29:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/advice-help-needed/m-p/359892#M28382</guid>
      <dc:creator>TateM</dc:creator>
      <dc:date>2013-10-19T02:29:53Z</dc:date>
    </item>
  </channel>
</rss>

