Skip to content

Migration documentation very confusing #626

Description

@matthjes

Hi,

I'm trying to understand the migration documentation, however, it is more than confusing.

The GIF at the top only shows errors. Commands are typed in, but each is followed by an error, nothing is shown. So basically this GIF is useless.

How can I configure a configuration? The documentation never shows, with an example, how to call sqlspec with the --config parameter. I have this directory layout (uv project):

app
|_.venv
|_ config.py

with config.py like:

from sqlspec.adapters.sqlite import SqliteConfig

config = SqliteConfig(
    connection_config={"database": str("test.db")},
    migration_config={
        "script_location": "migrations",
        "version_table": "_schema_versions"
    }
)
config.migrate_up()

Running uv run sqlspec init shows (same output from the GIF):

Error: No SQLSpec config found.

Specify config using one of:
  1. CLI flag:        sqlspec --config myapp.config:get_configs <command>
  2. Environment var: export SQLSPEC_CONFIG=myapp.config:get_configs
  3. pyproject.toml:  
                      config = "myapp.config:get_configs"

Running it with uv run sqlspec --config config init yields a bunch of error messages and

AttributeError: module 'config' has no attribute 'bind_key'

Running it with uv run sqlspec --config config:config init yields:

Error loading config: Failed to import config from path 'config:config': Could not import 'config:config': config:config doesn't look like a module 
path

So how do I event start with migrations?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions