diff --git a/sdk/cosmos/azure-cosmos/azure/cosmos/container.py b/sdk/cosmos/azure-cosmos/azure/cosmos/container.py index 73441d19f5ab..3480e39c485d 100644 --- a/sdk/cosmos/azure-cosmos/azure/cosmos/container.py +++ b/sdk/cosmos/azure-cosmos/azure/cosmos/container.py @@ -67,6 +67,10 @@ def __init__(self, client_connection, database_link, id, properties=None): # py self._is_system_key = None self._scripts = None # type: Optional[ScriptsProxy] + def __repr__(self): + # type () -> str + return "".format(self.container_link)[:1024] + def _get_properties(self): # type: () -> Dict[str, Any] if self._properties is None: diff --git a/sdk/cosmos/azure-cosmos/azure/cosmos/cosmos_client.py b/sdk/cosmos/azure-cosmos/azure/cosmos/cosmos_client.py index c7065f8f8e5b..9d8199d08c3d 100644 --- a/sdk/cosmos/azure-cosmos/azure/cosmos/cosmos_client.py +++ b/sdk/cosmos/azure-cosmos/azure/cosmos/cosmos_client.py @@ -194,6 +194,10 @@ def __init__(self, url, credential, consistency_level="Session", **kwargs): url, auth=auth, consistency_level=consistency_level, connection_policy=connection_policy, **kwargs ) + def __repr__(self): # pylint:disable=client-method-name-no-double-underscore + # type () -> str + return "".format(self.client_connection.url_connection)[:1024] + def __enter__(self): self.client_connection.pipeline_client.__enter__() return self diff --git a/sdk/cosmos/azure-cosmos/azure/cosmos/database.py b/sdk/cosmos/azure-cosmos/azure/cosmos/database.py index cc5067d003db..ec4397753271 100644 --- a/sdk/cosmos/azure-cosmos/azure/cosmos/database.py +++ b/sdk/cosmos/azure-cosmos/azure/cosmos/database.py @@ -76,6 +76,10 @@ def __init__(self, client_connection, id, properties=None): # pylint: disable=r self.database_link = u"dbs/{}".format(self.id) self._properties = properties + def __repr__(self): + # type () -> str + return "".format(self.database_link)[:1024] + @staticmethod def _get_container_id(container_or_id): # type: (Union[str, ContainerProxy, Dict[str, Any]]) -> str diff --git a/sdk/cosmos/azure-cosmos/azure/cosmos/partition_key.py b/sdk/cosmos/azure-cosmos/azure/cosmos/partition_key.py index 309e27ba64de..e361ee45b7bc 100644 --- a/sdk/cosmos/azure-cosmos/azure/cosmos/partition_key.py +++ b/sdk/cosmos/azure-cosmos/azure/cosmos/partition_key.py @@ -54,6 +54,10 @@ def __init__(self, path, kind="Hash", version=2): # pylint: disable=super-init- self.kind = kind self.version = version + def __repr__(self): + # type () -> str + return "".format(self.path)[:1024] + @property def kind(self): return self["kind"] diff --git a/sdk/cosmos/azure-cosmos/azure/cosmos/user.py b/sdk/cosmos/azure-cosmos/azure/cosmos/user.py index 9352d6755582..8b9af8893c75 100644 --- a/sdk/cosmos/azure-cosmos/azure/cosmos/user.py +++ b/sdk/cosmos/azure-cosmos/azure/cosmos/user.py @@ -47,6 +47,10 @@ def __init__(self, client_connection, id, database_link, properties=None): # py self.user_link = u"{}/users/{}".format(database_link, id) self._properties = properties + def __repr__(self): + # type () -> str + return "".format(self.user_link)[:1024] + def _get_permission_link(self, permission_or_id): # type: (Union[Permission, str, Dict[str, Any]]) -> str if isinstance(permission_or_id, six.string_types):