Store clients
These helpers return ready-to-use clients for data stores based on the current credentials profile.
Prerequisites
Before using store clients, configure credentials for the target store:
If you use multiple profiles, set the active one with dh.set_current_profile().
S3 client
Use get_s3_client() to access a configured boto3 S3 client.
import digitalhub as dh
s3 = dh.get_s3_client()
response = s3.list_buckets()
get_s3_client()
Returns a boto3 S3 client.
Returns:
| Type | Description |
|---|---|
S3Client
|
A boto3 S3 client instance. |
SQL engine
Use get_sql_engine() to create a SQLAlchemy engine connected to the configured database.
You can optionally pass a schema name.
import digitalhub as dh
engine = dh.get_sql_engine(schema="public")
get_sql_engine(schema=None)
Returns a SQLAlchemy engine connected to the database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
schema
|
str
|
The schema to connect to. |
None
|
Returns:
| Type | Description |
|---|---|
Engine
|
A SQLAlchemy engine instance connected to the database. |