1

Does anyone know of a method to use the table from SQL Server table using OS Authentication, instead of a File Geodatabase Table in ArcPy?

I have been using the below to reference the table

tableTemplate = r"C:\Data_table.gdb\DataTable"

where DataTable consists of a set of rows and columns. I have created a similar table in sql server and want to use the same instead of the above File Geodatabase Table.

I have tried the below so far with no luck:

arcpy.CreateDatabaseConnection_management(out_folder_path="Database Connections",
 out_name="DataTable.sde",
 database_platform="SQL_SERVER",
 instance="gis-server",
 account_authentication="OPERATING_SYSTEM_AUTH",
 database="TemporaryDatabase",
 version_type="TRANSACTIONAL",
 version="dbo.DEFAULT")
tableTemplate = r"Database Connections\TemporaryDatabase.sde\DataTable"

Am I doing something wrong somewhere? I get an error : "Database Connections\DataTable.sde\DataTable does not exist or is not supported." I am using arcpy.CopyRows_management later in the script.

asked Feb 11, 2019 at 7:35
7
  • Does the Connection work when you double-click it in ArcMap/ArcCatalog? Commented Feb 11, 2019 at 10:20
  • @BERA yes it does Commented Feb 11, 2019 at 10:26
  • Same, ERROR 000732: Input Rows: Dataset C:\Users\DebS\AppData\Roaming\ESRI\Desktop10.5\ArcCatalog\TemporaryDatabase.sde\DataTable does not exist or is not supported Failed to execute (CopyRows). Commented Feb 11, 2019 at 11:03
  • Doesn't still, same error. Commented Feb 11, 2019 at 11:21
  • Are you saying that the CreateDatabaseConnection in your script successfully creates a .sde file that you can later use in ArcCatalog? If so, I think you need tableTemplate = r"Database Connections\DataTable.sde\DataTable" at a minimum (and possibly also the appropriate schema/owner name before DataTable). Commented Feb 11, 2019 at 20:28

1 Answer 1

2

One thing that isn't right is that you specified out_name as DataTable.sde, and then use TemporaryDatabase.sde to open the connection.

You could try to create a new .sde file from within ArcCatalog first, so that you know you have all the correct settings. Perhaps you do not have the right privileges.

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
answered Feb 12, 2019 at 8:13

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.