pgsqlasync2fast-fastapi 0.2.0__tar.gz → 0.3.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pgsqlasync2fast_fastapi-0.2.0 → pgsqlasync2fast_fastapi-0.3.1}/MANIFEST.in +1 -1
- {pgsqlasync2fast_fastapi-0.2.0/src/pgsqlasync2fast_fastapi.egg-info → pgsqlasync2fast_fastapi-0.3.1}/PKG-INFO +3 -1
- {pgsqlasync2fast_fastapi-0.2.0 → pgsqlasync2fast_fastapi-0.3.1}/README.md +2 -0
- pgsqlasync2fast_fastapi-0.3.1/docs/seeder-format.md +199 -0
- pgsqlasync2fast_fastapi-0.3.1/examples/seeders/dev/categories.json +17 -0
- pgsqlasync2fast_fastapi-0.3.1/examples/seeders/dev/permissions.json +62 -0
- pgsqlasync2fast_fastapi-0.3.1/examples/seeders/dev/roles.json +22 -0
- pgsqlasync2fast_fastapi-0.3.1/examples/seeders/manifest.json +21 -0
- pgsqlasync2fast_fastapi-0.3.1/examples/seeders/prod/categories.json +12 -0
- pgsqlasync2fast_fastapi-0.3.1/examples/seeders/prod/permissions.json +38 -0
- pgsqlasync2fast_fastapi-0.3.1/examples/seeders/prod/roles.json +12 -0
- {pgsqlasync2fast_fastapi-0.2.0 → pgsqlasync2fast_fastapi-0.3.1}/pyproject.toml +10 -1
- pgsqlasync2fast_fastapi-0.3.1/src/pgsqlasync2fast_fastapi/__init__.py +89 -0
- pgsqlasync2fast_fastapi-0.3.1/src/pgsqlasync2fast_fastapi/__version__.py +1 -0
- pgsqlasync2fast_fastapi-0.3.1/src/pgsqlasync2fast_fastapi/seeder.py +801 -0
- pgsqlasync2fast_fastapi-0.3.1/src/pgsqlasync2fast_fastapi/skills/SKILL.md +70 -0
- {pgsqlasync2fast_fastapi-0.2.0 → pgsqlasync2fast_fastapi-0.3.1/src/pgsqlasync2fast_fastapi.egg-info}/PKG-INFO +3 -1
- {pgsqlasync2fast_fastapi-0.2.0 → pgsqlasync2fast_fastapi-0.3.1}/src/pgsqlasync2fast_fastapi.egg-info/SOURCES.txt +12 -2
- pgsqlasync2fast_fastapi-0.3.1/tests/test_seeder.py +1023 -0
- pgsqlasync2fast_fastapi-0.2.0/docs/.env.example +0 -50
- pgsqlasync2fast_fastapi-0.2.0/src/pgsqlasync2fast_fastapi/__init__.py +0 -49
- pgsqlasync2fast_fastapi-0.2.0/src/pgsqlasync2fast_fastapi/__version__.py +0 -1
- {pgsqlasync2fast_fastapi-0.2.0 → pgsqlasync2fast_fastapi-0.3.1}/LICENSE +0 -0
- {pgsqlasync2fast_fastapi-0.2.0 → pgsqlasync2fast_fastapi-0.3.1}/setup.cfg +0 -0
- {pgsqlasync2fast_fastapi-0.2.0 → pgsqlasync2fast_fastapi-0.3.1}/src/pgsqlasync2fast_fastapi/connection.py +0 -0
- {pgsqlasync2fast_fastapi-0.2.0 → pgsqlasync2fast_fastapi-0.3.1}/src/pgsqlasync2fast_fastapi/database.py +0 -0
- {pgsqlasync2fast_fastapi-0.2.0 → pgsqlasync2fast_fastapi-0.3.1}/src/pgsqlasync2fast_fastapi/dependencies.py +0 -0
- {pgsqlasync2fast_fastapi-0.2.0 → pgsqlasync2fast_fastapi-0.3.1}/src/pgsqlasync2fast_fastapi/settings.py +0 -0
- {pgsqlasync2fast_fastapi-0.2.0 → pgsqlasync2fast_fastapi-0.3.1}/src/pgsqlasync2fast_fastapi.egg-info/dependency_links.txt +0 -0
- {pgsqlasync2fast_fastapi-0.2.0 → pgsqlasync2fast_fastapi-0.3.1}/src/pgsqlasync2fast_fastapi.egg-info/requires.txt +0 -0
- {pgsqlasync2fast_fastapi-0.2.0 → pgsqlasync2fast_fastapi-0.3.1}/src/pgsqlasync2fast_fastapi.egg-info/top_level.txt +0 -0
- {pgsqlasync2fast_fastapi-0.2.0 → pgsqlasync2fast_fastapi-0.3.1}/tests/test_completo.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pgsqlasync2fast-fastapi
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.1
|
|
4
4
|
Summary: Simple and fast PostgreSQL async module for FastAPI with multi-database support
|
|
5
5
|
Author-email: Angel Daniel Sanchez Castillo <angeldaniel.sanchezcastillo@gmail.com>
|
|
6
6
|
License: MIT License
|
|
@@ -56,6 +56,8 @@ Dynamic: license-file
|
|
|
56
56
|
|
|
57
57
|
Simple and fast PostgreSQL async module for FastAPI with multi-database support and automatic database creation.
|
|
58
58
|
|
|
59
|
+
> 📖 **Conventions reference**: this package follows the [2fast-handbook](https://github.com/AngelDanielSanchezCastillo/2fast-handbook) for ecosystem conventions (structure, versioning, README, commits, release).
|
|
60
|
+
|
|
59
61
|
## Features
|
|
60
62
|
|
|
61
63
|
- ✅ **Multiple Database Connections**: Configure and manage multiple PostgreSQL databases
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Simple and fast PostgreSQL async module for FastAPI with multi-database support and automatic database creation.
|
|
4
4
|
|
|
5
|
+
> 📖 **Conventions reference**: this package follows the [2fast-handbook](https://github.com/AngelDanielSanchezCastillo/2fast-handbook) for ecosystem conventions (structure, versioning, README, commits, release).
|
|
6
|
+
|
|
5
7
|
## Features
|
|
6
8
|
|
|
7
9
|
- ✅ **Multiple Database Connections**: Configure and manage multiple PostgreSQL databases
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
# Seeder Format Documentation
|
|
2
|
+
|
|
3
|
+
Multi-package JSON seeder format for `pgsqlasync2fast-fastapi`.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The seeder system uses JSON files organized by profile (e.g., `dev`, `prod`) with a manifest.json defining table structure and dependencies.
|
|
8
|
+
|
|
9
|
+
## Directory Structure
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
seeders/
|
|
13
|
+
├── manifest.json # Table definitions and load order
|
|
14
|
+
├── dev/ # Development profile
|
|
15
|
+
│ ├── roles.json
|
|
16
|
+
│ ├── categories.json
|
|
17
|
+
│ └── permissions.json
|
|
18
|
+
└── prod/ # Production profile
|
|
19
|
+
├── roles.json
|
|
20
|
+
├── categories.json
|
|
21
|
+
└── permissions.json
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## manifest.json
|
|
25
|
+
|
|
26
|
+
The manifest defines which tables are seeded and their dependencies.
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"tables": {
|
|
31
|
+
"categories": {
|
|
32
|
+
"file": "categories.json"
|
|
33
|
+
},
|
|
34
|
+
"roles": {
|
|
35
|
+
"file": "roles.json"
|
|
36
|
+
},
|
|
37
|
+
"permissions": {
|
|
38
|
+
"file": "permissions.json",
|
|
39
|
+
"depends_on": ["categories"]
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"load_order": ["categories", "roles", "permissions"]
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Fields
|
|
47
|
+
|
|
48
|
+
| Field | Type | Required | Description |
|
|
49
|
+
|-------|------|----------|-------------|
|
|
50
|
+
| `tables` | object | Yes | Dictionary of table configurations |
|
|
51
|
+
| `tables.{name}` | object | Yes | Configuration for each table |
|
|
52
|
+
| `tables.{name}.file` | string | Yes | JSON filename containing the data |
|
|
53
|
+
| `tables.{name}.depends_on` | array | No | Array of table names this table depends on |
|
|
54
|
+
| `load_order` | array | No | Explicit load order (overrides dependency-based sort) |
|
|
55
|
+
|
|
56
|
+
## Table JSON Files
|
|
57
|
+
|
|
58
|
+
Each table has its own JSON file containing an array of row objects.
|
|
59
|
+
|
|
60
|
+
### Format
|
|
61
|
+
|
|
62
|
+
```json
|
|
63
|
+
[
|
|
64
|
+
{
|
|
65
|
+
"id": 1,
|
|
66
|
+
"name": "Admin",
|
|
67
|
+
"description": "Administrator role"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"id": 2,
|
|
71
|
+
"name": "User",
|
|
72
|
+
"description": "Regular user role"
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Requirements
|
|
78
|
+
|
|
79
|
+
- **Required fields**: Each row MUST have an `id` field (integer or string)
|
|
80
|
+
- **Data types**: JSON primitives (string, number, boolean, null)
|
|
81
|
+
- **Relationships**: Use explicit IDs to reference related entities
|
|
82
|
+
|
|
83
|
+
## Profiles
|
|
84
|
+
|
|
85
|
+
Profiles allow the same table structure with different data for different environments.
|
|
86
|
+
|
|
87
|
+
### Common Profiles
|
|
88
|
+
|
|
89
|
+
- `dev` - Development data (more records, test data)
|
|
90
|
+
- `prod` - Production data (minimal, realistic data)
|
|
91
|
+
|
|
92
|
+
### Profile Resolution
|
|
93
|
+
|
|
94
|
+
When calling `seed_all("dev")`, the system looks for data in `{manifest_dir}/dev/` folder.
|
|
95
|
+
|
|
96
|
+
## Foreign Key (FK) Validation
|
|
97
|
+
|
|
98
|
+
Before any inserts, the system validates that FK references point to existing IDs.
|
|
99
|
+
|
|
100
|
+
### FK Naming Convention
|
|
101
|
+
|
|
102
|
+
The system uses a simple naming convention:
|
|
103
|
+
- Table `categories` → FK field `category_id`
|
|
104
|
+
- Table `roles` → FK field `role_id`
|
|
105
|
+
- Table `permissions` → FK field `permission_id`
|
|
106
|
+
|
|
107
|
+
### Example
|
|
108
|
+
|
|
109
|
+
If `permissions.json` contains:
|
|
110
|
+
```json
|
|
111
|
+
[
|
|
112
|
+
{
|
|
113
|
+
"id": 1,
|
|
114
|
+
"name": "read:users",
|
|
115
|
+
"category_id": 1
|
|
116
|
+
}
|
|
117
|
+
]
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
The system validates that a category with `id=1` exists in `categories.json` before inserting.
|
|
121
|
+
|
|
122
|
+
### Validation Errors
|
|
123
|
+
|
|
124
|
+
If validation fails, `SeedValidationError` is raised with details:
|
|
125
|
+
```
|
|
126
|
+
Table 'permissions' row id=1 references non-existent categories id=999
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Priority
|
|
130
|
+
|
|
131
|
+
Packages have a `priority` value (default: 50) that determines execution order.
|
|
132
|
+
|
|
133
|
+
- **Lower values** = seeds first
|
|
134
|
+
- **Higher values** = seeds later
|
|
135
|
+
|
|
136
|
+
This allows controlling which package's data takes precedence when multiple packages are registered.
|
|
137
|
+
|
|
138
|
+
### Example
|
|
139
|
+
|
|
140
|
+
```python
|
|
141
|
+
register_seeder(SeederConfig(
|
|
142
|
+
connection_name="auth",
|
|
143
|
+
manifest_path="path/to/manifest.json",
|
|
144
|
+
package_name="my-package",
|
|
145
|
+
priority=50 # Seeds before packages with higher priority
|
|
146
|
+
))
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Conflict Detection
|
|
150
|
+
|
|
151
|
+
When registering a seeder, the system detects table conflicts.
|
|
152
|
+
|
|
153
|
+
### Rule
|
|
154
|
+
|
|
155
|
+
Two packages CANNOT seed the same table in the same connection.
|
|
156
|
+
|
|
157
|
+
### Error
|
|
158
|
+
|
|
159
|
+
If conflicts are detected, `SeederConflictError` is raised:
|
|
160
|
+
```
|
|
161
|
+
Tables {'roles'} conflict between 'pkg-a' and 'pkg-b' on connection 'auth'
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Idempotency
|
|
165
|
+
|
|
166
|
+
The seeder is idempotent - running multiple times produces the same result.
|
|
167
|
+
|
|
168
|
+
- Rows with existing IDs are skipped
|
|
169
|
+
- Only new rows are inserted
|
|
170
|
+
|
|
171
|
+
This allows safe re-runs without duplicating data.
|
|
172
|
+
|
|
173
|
+
## Usage Example
|
|
174
|
+
|
|
175
|
+
```python
|
|
176
|
+
from pgsqlasync2fast_fastapi import seed_all, register_seeder, SeederConfig
|
|
177
|
+
|
|
178
|
+
# Register a package's seeder
|
|
179
|
+
register_seeder(SeederConfig(
|
|
180
|
+
connection_name="auth",
|
|
181
|
+
manifest_path="my_package/seeders/manifest.json",
|
|
182
|
+
package_name="my-package",
|
|
183
|
+
priority=50
|
|
184
|
+
))
|
|
185
|
+
|
|
186
|
+
# Execute all seeders with dev profile
|
|
187
|
+
result = await seed_all("dev")
|
|
188
|
+
|
|
189
|
+
print(f"Seeded {result.tables_seeded} tables, {result.rows_seeded} rows")
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## Seed Flow
|
|
193
|
+
|
|
194
|
+
1. **Register**: `register_seeder()` validates no conflicts
|
|
195
|
+
2. **Resolve Order**: Tables sorted by `depends_on` + `priority`
|
|
196
|
+
3. **Load Data**: Each table's JSON loaded from profile folder
|
|
197
|
+
4. **Validate FKs**: All FK references verified before inserts
|
|
198
|
+
5. **Seed**: Idempotent inserts (skip existing IDs)
|
|
199
|
+
6. **Result**: Summary of seeded packages, tables, and rows
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": 1,
|
|
4
|
+
"name": "User Management",
|
|
5
|
+
"description": "Permissions related to user management"
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"id": 2,
|
|
9
|
+
"name": "Role Management",
|
|
10
|
+
"description": "Permissions related to role management"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"id": 3,
|
|
14
|
+
"name": "System Administration",
|
|
15
|
+
"description": "Permissions related to system administration"
|
|
16
|
+
}
|
|
17
|
+
]
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": 1,
|
|
4
|
+
"name": "users:read",
|
|
5
|
+
"description": "View user information",
|
|
6
|
+
"category_id": 1
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"id": 2,
|
|
10
|
+
"name": "users:create",
|
|
11
|
+
"description": "Create new users",
|
|
12
|
+
"category_id": 1
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"id": 3,
|
|
16
|
+
"name": "users:update",
|
|
17
|
+
"description": "Update existing users",
|
|
18
|
+
"category_id": 1
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"id": 4,
|
|
22
|
+
"name": "users:delete",
|
|
23
|
+
"description": "Delete users",
|
|
24
|
+
"category_id": 1
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"id": 5,
|
|
28
|
+
"name": "roles:read",
|
|
29
|
+
"description": "View role information",
|
|
30
|
+
"category_id": 2
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"id": 6,
|
|
34
|
+
"name": "roles:create",
|
|
35
|
+
"description": "Create new roles",
|
|
36
|
+
"category_id": 2
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"id": 7,
|
|
40
|
+
"name": "roles:update",
|
|
41
|
+
"description": "Update existing roles",
|
|
42
|
+
"category_id": 2
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"id": 8,
|
|
46
|
+
"name": "roles:delete",
|
|
47
|
+
"description": "Delete roles",
|
|
48
|
+
"category_id": 2
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"id": 9,
|
|
52
|
+
"name": "system:config",
|
|
53
|
+
"description": "Modify system configuration",
|
|
54
|
+
"category_id": 3
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"id": 10,
|
|
58
|
+
"name": "system:audit",
|
|
59
|
+
"description": "View audit logs",
|
|
60
|
+
"category_id": 3
|
|
61
|
+
}
|
|
62
|
+
]
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": 1,
|
|
4
|
+
"name": "Admin",
|
|
5
|
+
"description": "Full system administrator with all permissions"
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"id": 2,
|
|
9
|
+
"name": "Manager",
|
|
10
|
+
"description": "Manager with elevated privileges but limited system config"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"id": 3,
|
|
14
|
+
"name": "User",
|
|
15
|
+
"description": "Standard user with basic access"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"id": 4,
|
|
19
|
+
"name": "Guest",
|
|
20
|
+
"description": "Guest user with read-only access"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"fk_fields": {
|
|
3
|
+
"categories": "category_id",
|
|
4
|
+
"roles": "role_id",
|
|
5
|
+
"permissions": "permission_id"
|
|
6
|
+
},
|
|
7
|
+
"profile_folders": ["dev", "prod"],
|
|
8
|
+
"tables": {
|
|
9
|
+
"categories": {
|
|
10
|
+
"file": "categories.json"
|
|
11
|
+
},
|
|
12
|
+
"roles": {
|
|
13
|
+
"file": "roles.json"
|
|
14
|
+
},
|
|
15
|
+
"permissions": {
|
|
16
|
+
"file": "permissions.json",
|
|
17
|
+
"depends_on": ["categories"]
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"load_order": ["categories", "roles", "permissions"]
|
|
21
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": 1,
|
|
4
|
+
"name": "users:read",
|
|
5
|
+
"description": "View user information",
|
|
6
|
+
"category_id": 1
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"id": 2,
|
|
10
|
+
"name": "users:create",
|
|
11
|
+
"description": "Create new users",
|
|
12
|
+
"category_id": 1
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"id": 3,
|
|
16
|
+
"name": "users:update",
|
|
17
|
+
"description": "Update existing users",
|
|
18
|
+
"category_id": 1
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"id": 4,
|
|
22
|
+
"name": "roles:read",
|
|
23
|
+
"description": "View role information",
|
|
24
|
+
"category_id": 2
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"id": 5,
|
|
28
|
+
"name": "roles:create",
|
|
29
|
+
"description": "Create new roles",
|
|
30
|
+
"category_id": 2
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"id": 6,
|
|
34
|
+
"name": "roles:update",
|
|
35
|
+
"description": "Update existing roles",
|
|
36
|
+
"category_id": 2
|
|
37
|
+
}
|
|
38
|
+
]
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "pgsqlasync2fast-fastapi"
|
|
7
|
-
|
|
7
|
+
dynamic = ["version"]
|
|
8
8
|
description = "Simple and fast PostgreSQL async module for FastAPI with multi-database support"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -64,6 +64,15 @@ package-dir = {"" = "src"}
|
|
|
64
64
|
where = ["src"]
|
|
65
65
|
include = ["pgsqlasync2fast_fastapi*"]
|
|
66
66
|
|
|
67
|
+
# Single source of truth for the version: __version__.py
|
|
68
|
+
[tool.setuptools.dynamic]
|
|
69
|
+
version = {attr = "pgsqlasync2fast_fastapi.__version__.__version__"}
|
|
70
|
+
|
|
71
|
+
[tool.setuptools.package-data]
|
|
72
|
+
pgsqlasync2fast_fastapi = [
|
|
73
|
+
"skills/*.md",
|
|
74
|
+
]
|
|
75
|
+
|
|
67
76
|
[tool.pytest.ini_options]
|
|
68
77
|
testpaths = ["tests"]
|
|
69
78
|
python_files = ["test_*.py"]
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"""
|
|
2
|
+
pgsqlasync2fast-fastapi - PostgreSQL async extensions for FastAPI
|
|
3
|
+
|
|
4
|
+
This package provides database management and seeding capabilities.
|
|
5
|
+
|
|
6
|
+
The seeder module provides multi-package JSON seeder orchestration.
|
|
7
|
+
|
|
8
|
+
Example:
|
|
9
|
+
from pgsqlasync2fast_fastapi import seed_all, register_seeder, SeederConfig
|
|
10
|
+
|
|
11
|
+
# Register a package's seeder
|
|
12
|
+
register_seeder(SeederConfig(
|
|
13
|
+
connection_name="auth",
|
|
14
|
+
manifest_path="path/to/manifest.json",
|
|
15
|
+
package_name="my-package",
|
|
16
|
+
priority=50
|
|
17
|
+
))
|
|
18
|
+
|
|
19
|
+
# Execute all seeders
|
|
20
|
+
result = await seed_all("dev")
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
from .__version__ import __version__
|
|
24
|
+
from .connection import DatabaseManager, get_manager
|
|
25
|
+
from .database import create_database, database_exists, drop_database, list_databases
|
|
26
|
+
from .dependencies import (
|
|
27
|
+
get_db_engine,
|
|
28
|
+
get_db_manager,
|
|
29
|
+
get_db_session,
|
|
30
|
+
shutdown_database,
|
|
31
|
+
startup_database,
|
|
32
|
+
)
|
|
33
|
+
from .settings import DatabaseConnectionSettings, DatabaseSettings, settings
|
|
34
|
+
|
|
35
|
+
# Import seeder module
|
|
36
|
+
from pgsqlasync2fast_fastapi import seeder
|
|
37
|
+
|
|
38
|
+
# Re-export seeder-specific exports
|
|
39
|
+
from pgsqlasync2fast_fastapi.seeder import (
|
|
40
|
+
# Dataclasses
|
|
41
|
+
SeederConfig,
|
|
42
|
+
SeederResult,
|
|
43
|
+
# Exceptions
|
|
44
|
+
SeederException,
|
|
45
|
+
SeederConflictError,
|
|
46
|
+
SeedValidationError,
|
|
47
|
+
# Registry functions
|
|
48
|
+
register_seeder,
|
|
49
|
+
get_registered_seeders,
|
|
50
|
+
clear_registry,
|
|
51
|
+
# Main orchestrator
|
|
52
|
+
seed_all,
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
__all__ = [
|
|
56
|
+
# Version
|
|
57
|
+
"__version__",
|
|
58
|
+
# Main classes
|
|
59
|
+
"DatabaseManager",
|
|
60
|
+
"get_manager",
|
|
61
|
+
# Settings
|
|
62
|
+
"DatabaseSettings",
|
|
63
|
+
"DatabaseConnectionSettings",
|
|
64
|
+
"settings",
|
|
65
|
+
# FastAPI dependencies
|
|
66
|
+
"get_db_manager",
|
|
67
|
+
"get_db_engine",
|
|
68
|
+
"get_db_session",
|
|
69
|
+
"startup_database",
|
|
70
|
+
"shutdown_database",
|
|
71
|
+
# Database utilities
|
|
72
|
+
"database_exists",
|
|
73
|
+
"create_database",
|
|
74
|
+
"drop_database",
|
|
75
|
+
"list_databases",
|
|
76
|
+
# Dataclasses (seeder)
|
|
77
|
+
"SeederConfig",
|
|
78
|
+
"SeederResult",
|
|
79
|
+
# Exceptions (seeder)
|
|
80
|
+
"SeederException",
|
|
81
|
+
"SeederConflictError",
|
|
82
|
+
"SeedValidationError",
|
|
83
|
+
# Registry functions (seeder)
|
|
84
|
+
"register_seeder",
|
|
85
|
+
"get_registered_seeders",
|
|
86
|
+
"clear_registry",
|
|
87
|
+
# Main orchestrator (seeder)
|
|
88
|
+
"seed_all",
|
|
89
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.3.1"
|