Skip to content

Commit fa89595

Browse files
authored
Update LayerFileReader.py - createSDEConnection
Replace arcpy.CreateArcSDEConnectionFile_management with arcpy.management.CreateDatabaseConnection (ArcGIS Pro 3.x)
1 parent 13af002 commit fa89595

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

ArcGisUtil/ArcGisUtil/LayerFileReader.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,13 @@ def __init__(self, lyrLib, scrtchSpc, user, passwd):
3535
'CREDITS', 'definitionQuery', 'maxThreshold',
3636
'minThreshold', 'transparency', 'contrast', 'brightness']
3737

38-
def createSDEConnection(self, sdeServer, sdePort):
38+
def createSDEConnection(self, database_platform, instance):
3939
'''
40-
:param sdeServer: the sde host to connect to
41-
:type sdeServer: str
40+
:param database_platform: Specifies the database management system platform to which the connection will be made. The following are valid options: BIGQUERY, DAMENG, DB2, ORACLE, POSTGRESQL, REDSHIFT, SAP HANA, SNOWFLAKE, SQL_SERVER, TERADATA
41+
:type: str
4242
43-
:param sdePort: the sde port that the application server is
44-
listening on
45-
:type str:
43+
:param instance: The database server or instance to which the connection will be made.
44+
:type: str
4645
4746
Creates a arc sde connection file in the data directory named
4847
TempConnection.sde if the file already exists it will be deleted.
@@ -52,10 +51,9 @@ def createSDEConnection(self, sdeServer, sdePort):
5251
self.logger.debug("deleting and recreating the connection file")
5352
os.remove(connFile)
5453
self.logger.debug("Creating the connection file...")
55-
arcpy.CreateArcSDEConnectionFile_management(
56-
self.dataDir, "TempConnection", sdeServer, sdePort, "",
57-
"DATABASE_AUTH", self.user, self.passwd, "SAVE_USERNAME",
58-
"SDE.DEFAULT", "SAVE_VERSION")
54+
arcpy.management.CreateDatabaseConnection(
55+
self.dataDir, "TempConnection", database_platform, instance,
56+
"DATABASE_AUTH", self.user, self.passwd, "SAVE_USERNAME")
5957
self.logger.debug("Connection file successfully created...")
6058

6159
def readLyrFile(self, srcLyrFile):

0 commit comments

Comments
 (0)