graflo.object_storage¶
S3-compatible object storage helpers (boto3): config, bucket ensure, bulk upload.
This package is separate from graph :class:~graflo.db.ConnectionManager targets.
Use :class:~graflo.object_storage.config.MinioConfig with
:meth:~graflo.object_storage.config.MinioConfig.from_docker_env alongside
docker/minio/.env, same idea as Neo4jConfig.from_docker_env.
Modules:
| Name | Description |
|---|---|
bucket |
Ensure S3 buckets exist (idempotent) for bulk staging. |
config |
S3-compatible endpoint configuration (MinIO, AWS S3, etc.). |
s3_client |
Shared boto3 S3 client construction for staging and uploads. |
upload |
Upload local files to S3 for TigerGraph LOADING JOB paths. |
Attributes¶
S3EndpointConfig = MinioConfig
module-attribute
¶
__all__ = ['MinioConfig', 'S3EndpointConfig', 'boto3_s3_client_from_generalized', 'boto3_s3_client_from_minio', 'ensure_bucket_exists', 'ensure_staging_bucket_for_config', 'parse_dotenv_file', 'upload_staged_csvs']
module-attribute
¶
Classes¶
MinioConfig
¶
Bases: BaseModel
Credentials and endpoint for MinIO or any S3-compatible API (boto3).
Source code in graflo/object_storage/config.py
Attributes¶
access_key = Field(description='S3 access key id (MinIO root user or IAM key).')
class-attribute
instance-attribute
¶
bucket = Field(default='graflo-staging', description='Default bucket for staged bulk CSV objects.')
class-attribute
instance-attribute
¶
endpoint_url = Field(description='Base URL for the S3 API, e.g. http://127.0.0.1:9000')
class-attribute
instance-attribute
¶
loader_endpoint_url = Field(default=None, description='Optional S3 API URL for TigerGraph LOADING JOB (CREATE DATA_SOURCE). Set when TigerGraph runs in Docker and MinIO is on the host (e.g. http://172.17.0.1:9003). Boto3 uses endpoint_url above.')
class-attribute
instance-attribute
¶
model_config = ConfigDict(extra='forbid')
class-attribute
instance-attribute
¶
region = Field(default='us-east-1', description='AWS region string passed to boto3 (use us-east-1 for MinIO).')
class-attribute
instance-attribute
¶
secret_key = Field(description='S3 secret access key.')
class-attribute
instance-attribute
¶
Methods:¶
from_docker_env(docker_dir=None)
classmethod
¶
Load from docker/minio/.env (same layout as other docker/* stacks).
Source code in graflo/object_storage/config.py
to_s3_generalized_conn_config()
¶
Map to runtime provider config for :class:~graflo.connections.provider.S3GeneralizedConnConfig.
Source code in graflo/object_storage/config.py
Functions:¶
boto3_s3_client_from_generalized(cfg)
¶
Build a boto3 S3 client from :class:~graflo.connections.provider.S3GeneralizedConnConfig.
Source code in graflo/object_storage/s3_client.py
boto3_s3_client_from_minio(cfg)
¶
Build a boto3 S3 client from :class:~graflo.object_storage.config.MinioConfig.
Source code in graflo/object_storage/s3_client.py
ensure_bucket_exists(client, bucket)
¶
Create bucket if it does not exist. Return bucket.
Safe to call repeatedly. Raises :exc:botocore.exceptions.ClientError
for non-recoverable API errors.
Source code in graflo/object_storage/bucket.py
ensure_staging_bucket_for_config(cfg=None)
¶
Ensure :attr:~graflo.object_storage.config.MinioConfig.bucket exists.
If cfg is None, loads :meth:~graflo.object_storage.config.MinioConfig.from_docker_env.
Source code in graflo/object_storage/bucket.py
parse_dotenv_file(env_file)
¶
Parse a simple KEY=value .env file (no shell expansion).
Source code in graflo/object_storage/config.py
upload_staged_csvs(*, staged_files, bucket, key_prefix, session_id, s3_cfg)
¶
Upload files and return manifest key -> s3://bucket/key for GSQL.