DataConnection
Represents a data connection in Datagrok.
Examples
Create a connection to a Postgres database with login parameters
>>> conn_pg = DataConnection(
... name="my_postgres_conn",
... data_source=DataSourceType.Postgres,
... server="localhost",
... port=5432,
... db="mydb",
... new Credentials(login="postgres", password="postgres")
... )
>>> print(conn_pg.host) # Access arbitrary parameter
>>> conn_pg.password = "new_password" # Update arbitrary parameter
Create a connection to an S3 bucket with different parameters
>>> conn_s3 = DataConnection(
... name="my_s3_conn",
... data_source=DataSourceType.S3,
... bucket="my-bucket",
... region="us-west-2",
... new Credentials(accessKey="AKIA...", secretKey="...")
... )
>>> print(conn_s3.bucket) # Access bucket name
>>> conn_s3.region = "us-east-1" # Update region dynamically
Attributes
| Name | Type | Description |
|---|---|---|
| name | Optional[str] | Internal name of the model, used as an identifier. |
| id | Optional[str] | Unique identifier for the model instance. Can be None for new instances. |
| friendly_name | Optional[str] | Human-readable name for display purposes. Defaults to None. |
| created_on | Optional[datetime] | Timestamp indicating when the model was created. Defaults to None. |
| updated_on | Optional[datetime] | Timestamp indicating when the model was last updated. Defaults to None. |
| namespace | Optional[str] | Optional namespace prefix to distinguish models with the same name. Defaults to None. |
| data_source | DataSourceType | Type of data source this connection uses. |
| description | Optional[str] | Optional textual description of the data connection. |
| credentials | Optional[Credentials] | Authentication credentials used to access the data source. |
| tags | Optional[List[str]] | List of tags associated with the connection for categorization. **kwargs : dict Additional arbitrary parameters stored in the parameters dictionary. |