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.

  • Does the Connection work when you double-click it in ArcMap/ArcCatalog? – BERA Feb 11 at 10:20
  • @BERA yes it does – Deb Feb 11 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). – Deb Feb 11 at 11:03
  • Doesn't still, same error. – Deb Feb 11 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). – Andy Feb 11 at 20:28
0

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.