Context / Client / get_connection

get_connection

Context.Client.get_connection(**kwargs)

Returns a connection’s configuration and status.

See also: AWS API Documentation

Request Syntax

response = client.get_connection(
    connectionId='string'
)
Parameters:

connectionId (string) –

[REQUIRED]

The connection to return, by its ID (which starts with conn-) or its ARN.

Return type:

dict

Returns:

Response Syntax

{
    'id': 'string',
    'arn': 'string',
    'name': 'string',
    'dataSource': {
        'type': 'GLUE_DATA_CATALOG'|'BEDROCK_KNOWLEDGE_BASE'|'DATABRICKS'|'SNOWFLAKE',
        'location': {
            'arn': 'string'
        }
    },
    'scope': {
        'selectors': [
            {
                'path': [
                    {
                        'level': 'string',
                        'id': 'string'
                    },
                ]
            },
        ]
    },
    'accessConfig': {
        'iamRole': {
            'roleArn': 'string'
        }
    },
    'syncSchedule': {
        'frequency': 'HOURLY'|'DAILY'|'WEEKLY'|'MONTHLY',
        'cronExpression': 'string'
    },
    'ingestionConfig': {
        'roleArn': 'string'
    },
    'glueConnectionMappings': [
        {
            'path': [
                {
                    'level': 'string',
                    'id': 'string'
                },
            ],
            'glueConnectionArn': 'string'
        },
    ],
    'status': 'CREATING'|'ACTIVE'|'UPDATING'|'DELETING'|'FAILED',
    'failure': {
        'code': 'GLUE_CONNECTION_UNAVAILABLE',
        'message': 'string'
    },
    'subStatus': 'GLUE_CONNECTION_CREATED'|'GLUE_CONNECTION_VALIDATED'|'SYNC_JOB_CREATED',
    'createdAt': datetime(2015, 1, 1),
    'updatedAt': datetime(2015, 1, 1)
}

Response Structure

  • (dict) –

    A connection, as returned by CreateConnection, GetConnection, and UpdateConnection. id, arn, name, dataSource, status, createdAt, and updatedAt are always present. Every other member is optional.

    • id (string) –

      The ID of the connection.

    • arn (string) –

      The ARN of the connection.

    • name (string) –

      The name of the connection. You set it when you create the connection and can change it with UpdateConnection. Uses the same constraints as an agent context name. Always present.

    • dataSource (dict) –

      The typed reference to the external data source that this connection binds to. Its type, the authoritative kind of data source, is in dataSource.type.

      • type (string) –

        The kind of data source.

        Valid values:

        • GLUE_DATA_CATALOG - An AWS Glue Data Catalog, or an AWS Glue connection that fronts a federated AWS data source.

        • BEDROCK_KNOWLEDGE_BASE - An Amazon Bedrock knowledge base.

        • DATABRICKS - A Databricks third-party catalog.

        • SNOWFLAKE - A Snowflake third-party catalog.

      • location (dict) –

        Where the data source lives. For this scope, an AWS ARN only.

        • arn (string) –

          The ARN of the data source. Its account segment must be your account when you create the connection.

    • scope (dict) –

      The hierarchical subset of the data source this connection ingests.

      • selectors (list) –

        The selectors describing which parts of the data source are in scope.

        • (dict) –

          A single selector: an ordered path of {level, id} segments identifying a node in the data source’s resource hierarchy. On a GLUE_DATA_CATALOG connection the path can also name at most one glueService segment, which selects a service rather than a node (see DataSourceScope).

          • path (list) –

            Ordered hierarchy path from the root to the selected resource. Must be non-empty.

            • (dict) –

              One segment of a resource hierarchy path: the hierarchy level, such as database or table, and the id of the resource at that level. Both are required.

              In a GLUE_DATA_CATALOG connection’s scope, the level glueService names a service instead of a resource. Its id is one of the following:

              • GLUE - AWS Glue databases and tables.

              • SAGEMAKER_AI - Amazon SageMaker AI resources.

              • REDSHIFT - Amazon Redshift resources.

              • RDS - Amazon RDS resources.

              • MSK - Amazon Managed Streaming for Apache Kafka (Amazon MSK) resources.

              • KINESIS - Amazon Kinesis Data Streams resources.

              • FIREHOSE - Amazon Data Firehose resources.

              • DYNAMODB - Amazon DynamoDB resources.

              • KEYSPACES - Amazon Keyspaces (for Apache Cassandra) resources.

              • ELASTICACHE - Amazon ElastiCache resources.

              • OPENSEARCH - Amazon OpenSearch Service resources.

              • NEPTUNE - Amazon Neptune resources.

              • TIMESTREAM - Amazon Timestream resources.

              • ATHENA - Amazon Athena resources.

              • GLUE_SCHEMA_REGISTRY - AWS Glue Schema Registry resources.

              • S3 - Amazon S3 resources.

              • S3_VECTORS - Amazon S3 Vectors resources.

              Every later segment of the selector must name a level of that service. Any other value, a second glueService segment, or a glueService segment in any other position returns ValidationException. A resource path never contains glueService.

              • level (string) –

                The hierarchy level name for this segment (for example, “database”, “table”). Non-blank, no whitespace.

              • id (string) –

                The ID of the resource at this level. Non-blank. Can contain spaces, backticks, and % (it is a resource name), but no control characters. AWS Context matches it exactly.

    • accessConfig (dict) –

      Per-connection access configuration: the IAM role used for data access.

      Note

      This is a Tagged Union structure. Only one of the following top level keys will be set: iamRole. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:

      'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
      
      • iamRole (dict) –

        Assume-role access. The service assumes roleArn to read the connection’s data source.

        • roleArn (string) –

          The IAM role that AWS Context assumes to read this connection’s data source. The role must be in your account. AWS Context rejects a role in another account. It has the same format as ingestionConfig.roleArn. You must have iam:PassRole permission on the role to pass it to AWS Context. Otherwise, CreateConnection and UpdateConnection fail with AccessDeniedException.

    • syncSchedule (dict) –

      The effective sync schedule. Present for DATABRICKS and SNOWFLAKE connections ( DAILY if you didn’t specify one). Absent for GLUE_DATA_CATALOG and BEDROCK_KNOWLEDGE_BASE connections, which are event-driven.

      Note

      This is a Tagged Union structure. Only one of the following top level keys will be set: frequency, cronExpression. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:

      'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
      
      • frequency (string) –

        How often catalog synchronization runs. AWS Glue determines the schedule’s start time. Valid values:

        • HOURLY - Every 60 minutes.

        • DAILY - Every 1,440 minutes.

        • WEEKLY - Not supported. You can save this value on a connection created with publish set to false, but publishing the connection with this value returns ValidationException.

        • MONTHLY - Not supported. You can save this value on a connection created with publish set to false, but publishing the connection with this value returns ValidationException.

      • cronExpression (string) –

        Not supported. Catalog synchronization doesn’t support cron schedules, so publishing a connection with this member returns ValidationException. Use frequency instead.

    • ingestionConfig (dict) –

      The connection’s ingestion configuration (the IAM role a data producer assumes to push into this connection). Absent when no ingestion role is configured.

      • roleArn (string) –

        The IAM role in your account that a data producer assumes to push data into this connection’s agent contexts. Your account must own the role.

    • glueConnectionMappings (list) –

      The AWS Glue connection for each redshiftNamespace, each rdsInstance and rdsDatabase pair, or each snowflakeDatabase in scope. Absent when none is configured.

      • (dict) –

        A GlueConnectionMapping binds one resource in the connection’s scope to an existing AWS Glue connection that you specify for it. The mapping covers every scope selector that names that resource. For a redshiftNamespace, AWS Context does not check which resource your AWS Glue connection targets. AWS Context does not revalidate an update that resends the stored list unchanged. A response does not return a status for each mapping.

        • path (list) –

          The resource that this mapping binds, root first, in the same form as scope.selectors[].path. Required. Contains 1–2 segments:

          • On a GLUE_DATA_CATALOG connection, either a redshiftNamespace segment whose ID is an Amazon Redshift namespace ARN ( namespace:<id>, or namespace/<id> for Amazon Redshift Serverless), or an rdsInstance segment whose ID is an Amazon RDS DB cluster or DB instance ARN ( cluster:<id> or db:<id>) followed by an rdsDatabase segment whose ID is the database name. The ARN must be in your account and Region.

          • On a SNOWFLAKE connection whose dataSource is an AWS Glue connection, a snowflakeDatabase segment whose ID is the database name, at most 255 characters.

          • (dict) –

            One segment of a resource hierarchy path: the hierarchy level, such as database or table, and the id of the resource at that level. Both are required.

            In a GLUE_DATA_CATALOG connection’s scope, the level glueService names a service instead of a resource. Its id is one of the following:

            • GLUE - AWS Glue databases and tables.

            • SAGEMAKER_AI - Amazon SageMaker AI resources.

            • REDSHIFT - Amazon Redshift resources.

            • RDS - Amazon RDS resources.

            • MSK - Amazon Managed Streaming for Apache Kafka (Amazon MSK) resources.

            • KINESIS - Amazon Kinesis Data Streams resources.

            • FIREHOSE - Amazon Data Firehose resources.

            • DYNAMODB - Amazon DynamoDB resources.

            • KEYSPACES - Amazon Keyspaces (for Apache Cassandra) resources.

            • ELASTICACHE - Amazon ElastiCache resources.

            • OPENSEARCH - Amazon OpenSearch Service resources.

            • NEPTUNE - Amazon Neptune resources.

            • TIMESTREAM - Amazon Timestream resources.

            • ATHENA - Amazon Athena resources.

            • GLUE_SCHEMA_REGISTRY - AWS Glue Schema Registry resources.

            • S3 - Amazon S3 resources.

            • S3_VECTORS - Amazon S3 Vectors resources.

            Every later segment of the selector must name a level of that service. Any other value, a second glueService segment, or a glueService segment in any other position returns ValidationException. A resource path never contains glueService.

            • level (string) –

              The hierarchy level name for this segment (for example, “database”, “table”). Non-blank, no whitespace.

            • id (string) –

              The ID of the resource at this level. Non-blank. Can contain spaces, backticks, and % (it is a resource name), but no control characters. AWS Context matches it exactly.

        • glueConnectionArn (string) –

          The ARN of your AWS Glue connection for path, in your account and Region. Required. The connection type must be one that path accepts:

          • redshiftNamespace - A REDSHIFT unified connection (ConnectionSchemaVersion 2).

          • rdsInstance and rdsDatabase - A POSTGRESQL unified connection, or, for an RDS DB instance, also ORACLE, with its DATABASE property set to that rdsDatabase.

          • snowflakeDatabase - A SNOWFLAKE connection with a ROLE_ARN and its DATABASE property set to that database. The ROLE_ARN must allow glue:GetConnection on that connection.

          AWS Context synchronizes the database through this connection. It doesn’t change DATABASE on a connection that it didn’t create. If AWS Glue is still validating the connection, the request fails with ConflictException. If its validation failed, the request fails with AccessDeniedException.

    • status (string) –

      The connection’s status. Valid values:

      • CREATING - Validation or provisioning is still in progress.

      • ACTIVE - The data source is reachable and, for a DATABRICKS or SNOWFLAKE connection, AWS Glue has provisioned catalog synchronization and returned its crawler ARN. This doesn’t mean that a crawl has started or completed.

      • UPDATING - The connection is being updated.

      • DELETING - The connection is being deleted.

      • FAILED - Validation or provisioning failed, and the connection can’t recover.

    • failure (dict) –

      The reason the connection is FAILED. Absent in every other status.

      • code (string) –

        A code that identifies why the connection failed. Codes include the following:

        • GLUE_CONNECTION_UNAVAILABLE - The AWS Glue connection failed AWS Glue validation or no longer exists, or AWS Context couldn’t provision catalog synchronization. Check the AWS Glue connection in the AWS Glue console, and then create the connection again.

        New codes can be added, so handle a code that you don’t recognize. Use code, not message, to decide how to respond.

      • message (string) –

        The failure message. For an AWS Glue connection that failed validation, this is the StatusReason from AWS Glue. Otherwise, it is a message from AWS Context.

    • subStatus (string) –

      The last milestone a third-party connection’s lifecycle reached. Present in two statuses: CREATING, where it shows the resources provisioned so far, and DELETING, where it shows the resources removed so far. Absent in every other status and while nothing has been done yet in the current direction. CREATING at GLUE_CONNECTION_VALIDATED on a connection created with publish: false means it is waiting for UpdateConnection publish: true.

    • createdAt (datetime) –

      The date and time when the connection was created.

    • updatedAt (datetime) –

      When the resource last changed. Equal to createdAt until the first update.

Exceptions