Configuration¶
Metaxy can be configured using TOML configuration files or environment variables.
Default Configuration¶
Here is the complete default configuration with all available options:
# Default metadata store to use
store = "dev"
# Optional: Named store configurations
# stores = {}
# Directory where migration files are stored
migrations_dir = ".metaxy/migrations"
# Optional: List of Python module paths to load for feature discovery
# entrypoints = []
# Graph rendering theme for CLI visualization
theme = "default"
# Optional: Truncate hash values to this length (minimum 8 characters). None = no truncation.
# hash_truncation_length = null
# Auto-create tables when opening stores (development/testing only). WARNING: Do not use in production. Use proper database migration tools like Alembic.
auto_create_tables = false
# Project name for metadata isolation. Used to scope system tables and operations to enable multiple independent projects in a shared metadata store. Does not modify feature keys or table names. Project names must be valid identifiers (alphanumeric, underscores, hyphens) and cannot contain forward slashes (/) or double underscores (__)
project = "default"
[ext.sqlmodel]
# Whether to enable the plugin.
enable = false
# Whether to automatically use `FeatureKey.table_name` for sqlalchemy's __tablename__ value.
infer_db_table_names = true
# Whether to use SQLModel definitions for system tables (for Alembic migrations).
system_tables = true
[tool.metaxy]
# Default metadata store to use
store = "dev"
# Optional: Named store configurations
# stores = {}
# Directory where migration files are stored
migrations_dir = ".metaxy/migrations"
# Optional: List of Python module paths to load for feature discovery
# entrypoints = []
# Graph rendering theme for CLI visualization
theme = "default"
# Optional: Truncate hash values to this length (minimum 8 characters). None = no truncation.
# hash_truncation_length = null
# Auto-create tables when opening stores (development/testing only). WARNING: Do not use in production. Use proper database migration tools like Alembic.
auto_create_tables = false
# Project name for metadata isolation. Used to scope system tables and operations to enable multiple independent projects in a shared metadata store. Does not modify feature keys or table names. Project names must be valid identifiers (alphanumeric, underscores, hyphens) and cannot contain forward slashes (/) or double underscores (__)
project = "default"
[tool.metaxy.ext.sqlmodel]
# Whether to enable the plugin.
enable = false
# Whether to automatically use `FeatureKey.table_name` for sqlalchemy's __tablename__ value.
infer_db_table_names = true
# Whether to use SQLModel definitions for system tables (for Alembic migrations).
system_tables = true
Configuration Fields¶
Each field can be set via TOML configuration or environment variables.
store¶
Default metadata store to use
Type: str
| Default: "dev"
Environment Variable:
stores¶
Named store configurations
Type: dict[str, metaxy.config.StoreConfig]
Environment Variable:
migrations_dir¶
Directory where migration files are stored
Type: str
| Default: ".metaxy/migrations"
Environment Variable:
entrypoints¶
List of Python module paths to load for feature discovery
Type: list[str]
Environment Variable:
theme¶
Graph rendering theme for CLI visualization
Type: str
| Default: "default"
Environment Variable:
hash_truncation_length¶
Truncate hash values to this length (minimum 8 characters). None = no truncation.
Type: int | None
Environment Variable:
auto_create_tables¶
Auto-create tables when opening stores (development/testing only). WARNING: Do not use in production. Use proper database migration tools like Alembic.
Type: bool
| Default: False
Environment Variable:
project¶
Project name for metadata isolation. Used to scope system tables and operations to enable multiple independent projects in a shared metadata store. Does not modify feature keys or table names. Project names must be valid identifiers (alphanumeric, underscores, hyphens) and cannot contain forward slashes (/) or double underscores (__)
Type: str
| Default: "default"
Environment Variable:
Ext > Sqlmodel Configuration¶
ext.sqlmodel.enable¶
Whether to enable the plugin.
Type: bool
| Default: False
Environment Variable:
ext.sqlmodel.infer_db_table_names¶
Whether to automatically use FeatureKey.table_name for sqlalchemy's tablename value.
Type: bool
| Default: True
Environment Variable:
ext.sqlmodel.system_tables¶
Whether to use SQLModel definitions for system tables (for Alembic migrations).
Type: bool
| Default: True
Environment Variable:
Configuration Types¶
StoreConfig¶
Configuration for a single metadata store backend.
Fields:
type(str): Full import path to the store classconfig(dict[str, Any]): Store-specific configuration options
ExtConfig¶
Configuration for Metaxy integrations with third-party tools.
Fields:
sqlmodel(SQLModelConfig): SQLModel integration configuration
SQLModelConfig¶
Configuration for SQLModel integration.
Fields:
enable(bool): Whether to enable the plugin (default:false)infer_db_table_names(bool): Whether to automatically useFeatureKey.table_namefor sqlalchemy's__tablename__value (default:true)system_tables(bool): Whether to use SQLModel definitions for system tables (default:true)
Store Configuration¶
The stores field configures metadata store backends. Each store is defined by:
type: Full import path to the store class (e.g.,metaxy.metadata_store.duckdb.DuckDBMetadataStore)config: Dictionary of store-specific configuration options
Example: Multiple Stores with Fallback Chain¶
# Default store to use
store = "dev"
# Development store (in-memory) with fallback to production
[stores.dev]
type = "metaxy.metadata_store.duckdb.DuckDBMetadataStore"
[stores.dev.config]
db_path = ":memory:"
fallback_stores = ["prod"]
# Production store
[stores.prod]
type = "metaxy.metadata_store.duckdb.DuckDBMetadataStore"
[stores.prod.config]
db_path = "s3://my-bucket/metadata.duckdb"
[tool.metaxy]
store = "dev"
[tool.metaxy.stores.dev]
type = "metaxy.metadata_store.duckdb.DuckDBMetadataStore"
[tool.metaxy.stores.dev.config]
db_path = ":memory:"
fallback_stores = ["prod"]
[tool.metaxy.stores.prod]
type = "metaxy.metadata_store.duckdb.DuckDBMetadataStore"
[tool.metaxy.stores.prod.config]
db_path = "s3://my-bucket/metadata.duckdb"
Available Store Types¶
| Store Type | Import Path | Description |
|---|---|---|
| DuckDB | metaxy.metadata_store.duckdb.DuckDBMetadataStore |
File-based or in-memory DuckDB backend |
| ClickHouse | metaxy.metadata_store.clickhouse.ClickHouseMetadataStore |
ClickHouse database backend |
| In-Memory | metaxy.metadata_store.memory.InMemoryMetadataStore |
In-memory backend for testing |
Getting a Store Instance¶
from metaxy.config import MetaxyConfig
config = MetaxyConfig.load()
# Get the default store
with config.get_store() as store:
# Use store
pass
# Get a specific store by name
with config.get_store("prod") as store:
# Use store
pass
Configuration Priority¶
When the same setting is defined in multiple places, Metaxy uses the following priority order (highest to lowest):
- Explicit arguments - Values passed directly to
MetaxyConfig() - Environment variables - Values from
METAXY_*environment variables - Configuration files - Values from
metaxy.tomlorpyproject.toml
This allows you to override file-based configuration with environment variables, which is useful for CI/CD pipelines and different deployment environments.
Loading Configuration¶
Auto-Discovery¶
from metaxy.config import MetaxyConfig
# Auto-discover config file in current or parent directories
config = MetaxyConfig.load()