db:seed
Populate the database using feature-level seeders, in topological dependency order.
Usage
splent db:seed [<feature_name>] [--reset] [-y]
Examples
Run all seeders:
splent db:seed
Seed only one feature:
splent db:seed splent_feature_auth
Clear all data and re-seed from scratch:
splent db:seed --reset -y
This deletes all row data (using DELETE, not DROP) — tables, migrations, and schema stay intact.
Options
| Option | Description |
|---|---|
<feature_name> |
Optional. Seed only this feature module. |
--reset |
Clear all row data before seeding (tables, migrations, and schema are preserved). |
-y, --yes |
Skip confirmation prompts. |
Description
Discovers and runs seeders.py from each installed feature.
Topological execution order
Seeders run in the same topological order as feature:order — features that depend on others always seed after their dependencies. This matters when a seeder creates data that references models from another feature (e.g. splent_feature_auth creates User records before splent_feature_profile creates UserProfile records that reference them).
The order is resolved from the product’s UVL constraints. If no UVL is available, the pyproject.toml declaration order is used.
Writing a seeder
Each feature’s seeders.py must contain a class that extends BaseSeeder and implements run():
from splent_framework.seeders.BaseSeeder import BaseSeeder
from splent_io.splent_feature_auth.models import User
class AuthSeeder(BaseSeeder):
def run(self):
users = [
User(email="admin@example.com", password="secret"),
]
self.seed(users)
self.seed(data) inserts a list of model instances and returns them with database IDs assigned. It raises SeederError on integrity violations.
There is no priority attribute. Execution order is determined exclusively by the UVL dependency constraints, the same mechanism used at runtime and in feature:order.
Duplicate data
If the database already contains seeded data and you run db:seed without --reset, seeders will fail on duplicate entries:
❌ AuthSeeder: duplicate data detected.
The database already contains seeded data.
Run: splent db:seed --reset
Use --reset to clear all data before re-seeding. This only deletes row data — tables, migrations, and schema stay intact.
--reset vs db:reset
| Command | What it does |
|---|---|
db:seed --reset |
Clears row data (DELETE), then seeds. Schema untouched. |
db:reset |
Drops ALL tables (DROP), re-applies migrations, recreates schema. |
Use db:seed --reset for day-to-day development. Use db:reset only when the schema itself needs to be rebuilt from scratch.
Requirements
SPLENT_APPmust be set.- The database must be reachable.
- Features must be installed (
splent product:resolve).
See also
feature:order— inspect the topological order before seedingdb:reset— wipe the databasedb:upgrade— apply migrations before seeding