AcceptConnections (arcpy)


Allows an administrator to enable or disable the ability of nonadministrative users to make connections to an enterprise geodatabase.


The AcceptConnections function is used by an administrative user to temporarily block connections to an Enterprise geodatabase. This function is used to complement the Connections tab on an Enterprise geodatabase properties page found in ArcGIS for Desktop.


AcceptConnections (sde_workspace, accept_connections)
ParámetroExplicaciónTipo de datos

The Enterprise geodatabase that will have its connection property altered.

The connection properties specified in the Enterprise Geodatabase must be the geodatabase administrator.


Boolean value indicating if the geodatabase will accept connections (True) or will not accept connections (False).


Ejemplo de código

AcceptConnections example 1

The following example demonstrates how to prevent connections to a geodatabase.

import arcpy

arcpy.AcceptConnections("Database Connections/admin.sde", False)
AcceptConnections example 2

The following example demonstrates how to prevent connections to a geodatabase, disconnect active connections, then run a geodatabase compress.

import arcpy

# Set Admin workspace variable
admin_workspace = "Database Connections/admin.sde"

# Block connections
arcpy.AcceptConnections(admin_workspace, False)

# Disconnect users
arcpy.DisconnectUser(admin_workspace, 'ALL')

# Reconcile/Post using default parameters.
arcpy.ReconcileVersions_management(admin_workspace, 'ALL_VERSIONS',
                                   'sde.DEFAULT', with_post='POST')

# Compress the geodatabase

# Allow connections.
arcpy.AcceptConnections(admin_workspace, True)

Temas relacionados