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.
CreateDatabaseConnectionin your script successfully creates a .sde file that you can later use in ArcCatalog? If so, I think you needtableTemplate = r"Database Connections\DataTable.sde\DataTable"at a minimum (and possibly also the appropriate schema/owner name beforeDataTable).