ZTeraDB Configuration Guide
This guide explains how to configure the ZTeraDB Python client using the ZTeraDBConfig class.
๐ฏ What is ZTeraDBConfig?
ZTeraDBConfig is a PHP configuration object that contains all authentication details, environment settings, and optional connection settings required to connect your application to ZTeraDB Server.
It is required for every ZTeraDB connection.
๐งฉ Full Structure
from zteradb.zteradb_config import (
ZTeraDBConfig,
ENVS,
ResponseDataTypes,
Options
)
config = ZTeraDBConfig(
client_key="string",
access_key="string",
secret_key="string",
database_id="string",
env=ENVS("dev | staging | qa | prod"),
response_data_type=ResponseDataTypes("json"),
options=Options(connection_pool=dict(
min=0,
max=0
))
)
๐ Field-by-field Explanation
๐ client_keyโ
- Your unique ZTeraDB account key.
- Get it from: Dashboard โ Security Credentials.
๐ access_keyโ
- Required for authenticating outgoing requests.
- You can generate multiple access keys.
- Only one active access key is allowed at a time.
๐งฉ secret_keyโ
- Secret signature key used to verify request authenticity.
- You will only see it once when creating it.
- Never share it or commit it to Git.
๐ database_idโ
- Unique ID of your ZTeraDB database.
- Example:
"7K3WHGOJKJJEJ3PFJM407QO25F"
๐ envโ
Defines which ZTeraDB environment you want to connect to.
Allowed values:
dev-> Development Environmentstaging-> Staging Environmentqa-> QA Environmentprod-> Production Environment
Usage example:
env=ENVS("dev")
๐ฆ response_data_typeโ
- Currently supports only
"json":
response_data_type=ResponseDataTypes("json")
- Future formats may be added later.
โ๏ธ options.connection_poolโ
You can control automatic connection pooling:
| Field | Meaning |
|---|---|
min | Minimum connections ZTeraDB should maintain |
max | Maximum number of allowed connections |
Example:
options=Options(connection_pool=dict(
min=2,
max=10
))
If omitted โ ZTeraDB automatically manages the pool.
๐งช Complete Example
from zteradb.zteradb_config import (
ZTeraDBConfig,
Options,
ENVS,
ResponseDataTypes
)
config = ZTeraDBConfig(
client_key="<Your ZTeraDB client key>",
access_key="<Your ZTeraDB access key>",
secret_key="<Your ZTeraDB secret key>",
database_id="<Your ZTeraDB database id>",
env=ENVS("dev"),
response_data_type=ResponseDataTypes("json"),
options=Options(connection_pool=dict(min=1, max=5))
)
โ ๏ธ Common Mistakes (Read This!)
โ Wrong environment name
โ Use only: "dev", "staging", "qa", "prod"
โ Missing secret key
โ Ensure all fields are present in environment variables
โ Credentials stored inside code
โ Always use .env variables to store keys
โ No connection pool in high-traffic apps
โ Set min and max based on workload
๐ You are ready to create a connection!
Continue to:
๐ zteradb-connection.md