graflo.hq.connection_provider¶
Runtime connection/config resolution for source connectors.
This module defines a connector-centric runtime indirection:
Bindings (contract) -> conn_proxy name -> GeneralizedConnConfig (runtime).
ApiAuth
¶
Bases: BaseModel
Authentication payload for REST API source access.
Source code in graflo/connection_models.py
ApiGeneralizedConnConfig
¶
Bases: BaseModel
Generalized runtime config variant for REST API connections.
Source code in graflo/connection_models.py
ConnectionProvider
¶
Bases: Protocol
Resolve runtime source connection/auth configuration.
New connector-centric resolution (preferred):
- :meth:get_generalized_conn_config takes a connector and returns the
generalized runtime config.
Legacy helpers (kept for backwards compatibility):
- :meth:get_postgres_config
- :meth:get_sparql_auth
Source code in graflo/hq/connection_provider.py
EmptyConnectionProvider
¶
No-op provider when no source credentials/config are configured.
Source code in graflo/hq/connection_provider.py
InMemoryConnectionProvider
¶
Bases: BaseModel
Simple in-memory provider for proxy-based generalized configs.
Supports two wiring modes:
- New: proxy_by_connector_hash + configs_by_proxy
- Legacy: per-resource maps (postgres_by_resource / sparql_by_resource)
Source code in graflo/hq/connection_provider.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | |
bind_from_bindings(*, bindings)
¶
Populate proxy_by_connector_hash from the contract bindings.
Source code in graflo/hq/connection_provider.py
bind_single_config_for_bindings(*, bindings, conn_proxy, config)
¶
Bind one generalized config to all connectors in bindings.
This is intended for the common case where a single source DB (or single generalized API endpoint) supplies all SQL/SPARQL connectors in the manifest.
Raises:
| Type | Description |
|---|---|
ValueError
|
if bindings use multiple different |
Source code in graflo/hq/connection_provider.py
register_all_api_configs_from_env(*, bindings, env_prefix_map=None)
¶
Register env-backed API configs for all API conn_proxy labels in bindings.
Discovers unique conn_proxy values attached to :class:APIConnector
instances, loads each via :meth:register_api_config_from_env, then binds
all connectors from bindings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bindings
|
Bindings
|
Manifest bindings with |
required |
env_prefix_map
|
dict[str, str] | None
|
Optional per-proxy env prefix overrides. |
None
|
Source code in graflo/hq/connection_provider.py
register_api_config_from_env(*, conn_proxy, env_prefix=None)
¶
Register REST API runtime config for conn_proxy from environment variables.
env_prefix defaults to a proxy-derived prefix (e.g. user_service →
USER_SERVICE_), reading {prefix}BASE_URL and optional auth vars.
Source code in graflo/hq/connection_provider.py
register_s3_config(*, conn_proxy, config)
¶
Store S3 staging credentials/config under conn_proxy.
PostgresGeneralizedConnConfig
¶
Bases: BaseModel
Generalized runtime config variant for SQL/Postgres connections.
Source code in graflo/connection_models.py
RestApiConnConfig
¶
Bases: BaseModel
Runtime REST API connection settings (base URL and credentials).
Source code in graflo/connection_models.py
from_env(env_prefix)
classmethod
¶
Load REST API config from environment variables.
Supported variables (all prefixed with env_prefix):
BASE_URL(required)AUTH_TYPE:bearer,basic,digest, orapi_key(default:bearer)TOKEN,USERNAME,PASSWORDHEADER_NAME,PREFIX(bearer / api_key)
Source code in graflo/connection_models.py
S3GeneralizedConnConfig
¶
Bases: BaseModel
Runtime credentials and defaults for S3 staging (TigerGraph bulk ingest).
Source code in graflo/connection_models.py
SparqlAuth
¶
SparqlGeneralizedConnConfig
¶
Bases: BaseModel
Generalized runtime config variant for SPARQL endpoint connections.