@ai-devtools/dbspec-linux-x64 0.7.19 → 1.0.1
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.
- package/bin/dbspec/_internal/base_library.zip +0 -0
- package/bin/dbspec/_internal/dbspec.egg-info/PKG-INFO +2 -2
- package/bin/dbspec/_internal/dbspec.egg-info/SOURCES.txt +5 -0
- package/bin/dbspec/_internal/dbspec.egg-info/requires.txt +1 -1
- package/bin/dbspec/_internal/pyproject.toml +2 -2
- package/bin/dbspec/_internal/src/resources/sqlalchemy_templates/model.py.j2 +23 -1
- package/bin/dbspec/dbspec +0 -0
- package/package.json +1 -1
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dbspec
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 1.0.1
|
|
4
4
|
Summary: DBSpec: CLI/TUI for database design (Excel as DSL)
|
|
5
5
|
Requires-Python: >=3.11
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -8,7 +8,7 @@ Requires-Dist: textual
|
|
|
8
8
|
Requires-Dist: rich
|
|
9
9
|
Requires-Dist: openpyxl
|
|
10
10
|
Requires-Dist: pydantic>=2.0.0
|
|
11
|
-
Requires-Dist: sqlalchemy
|
|
11
|
+
Requires-Dist: sqlalchemy>=2.0.16
|
|
12
12
|
Requires-Dist: alembic
|
|
13
13
|
Requires-Dist: psycopg[binary]
|
|
14
14
|
Requires-Dist: jinja2
|
|
@@ -24,11 +24,13 @@ src/cli_commands/validate.py
|
|
|
24
24
|
src/cli_commands/xlsx.py
|
|
25
25
|
src/db_import/__init__.py
|
|
26
26
|
src/db_import/cli_renderer.py
|
|
27
|
+
src/db_import/constraints.py
|
|
27
28
|
src/db_import/importer.py
|
|
28
29
|
src/db_import/result.py
|
|
29
30
|
src/db_import/tui_adapter.py
|
|
30
31
|
src/generators/__init__.py
|
|
31
32
|
src/generators/sqlalchemy/__init__.py
|
|
33
|
+
src/generators/sqlalchemy/constraints.py
|
|
32
34
|
src/generators/sqlalchemy/context.py
|
|
33
35
|
src/generators/sqlalchemy/enums.py
|
|
34
36
|
src/generators/sqlalchemy/generate.py
|
|
@@ -39,12 +41,14 @@ src/generators/sqlalchemy/types.py
|
|
|
39
41
|
src/logic/__init__.py
|
|
40
42
|
src/logic/check_rules.py
|
|
41
43
|
src/logic/db_validation.py
|
|
44
|
+
src/logic/db_validation_constraints.py
|
|
42
45
|
src/logic/diagnostics.py
|
|
43
46
|
src/logic/parser.py
|
|
44
47
|
src/logic/validator.py
|
|
45
48
|
src/logic/validation_rules/__init__.py
|
|
46
49
|
src/logic/validation_rules/base.py
|
|
47
50
|
src/logic/validation_rules/check_rules.py
|
|
51
|
+
src/logic/validation_rules/constraints.py
|
|
48
52
|
src/logic/validation_rules/domains.py
|
|
49
53
|
src/logic/validation_rules/enums.py
|
|
50
54
|
src/logic/validation_rules/foreign_keys.py
|
|
@@ -182,6 +186,7 @@ src/xlsx/template/apply_formulas.py
|
|
|
182
186
|
src/xlsx/template/apply_styles.py
|
|
183
187
|
src/xlsx/template/apply_validation.py
|
|
184
188
|
src/xlsx/template/constants.py
|
|
189
|
+
src/xlsx/template/formula_config.py
|
|
185
190
|
src/xlsx/template/generator.py
|
|
186
191
|
src/xlsx/template/sheet_data.py
|
|
187
192
|
src/xlsx/template/utils.py
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "dbspec"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "1.0.1"
|
|
8
8
|
description = "DBSpec: CLI/TUI for database design (Excel as DSL)"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
@@ -13,7 +13,7 @@ dependencies = [
|
|
|
13
13
|
"rich",
|
|
14
14
|
"openpyxl",
|
|
15
15
|
"pydantic>=2.0.0",
|
|
16
|
-
"sqlalchemy",
|
|
16
|
+
"sqlalchemy>=2.0.16",
|
|
17
17
|
"alembic",
|
|
18
18
|
"psycopg[binary]",
|
|
19
19
|
"jinja2",
|
|
@@ -105,6 +105,17 @@ from ..{{ common_dir_name }}.base import metadata
|
|
|
105
105
|
{% for check in table.check_constraints %}
|
|
106
106
|
CheckConstraint("{{ check.expression | replace('"', '\\"') }}", name="{{ check.name }}"),
|
|
107
107
|
{% endfor %}
|
|
108
|
+
{% for constraint in table.unique_constraints %}
|
|
109
|
+
UniqueConstraint(
|
|
110
|
+
{% for c in constraint.columns %}
|
|
111
|
+
"{{ c }}",
|
|
112
|
+
{% endfor %}
|
|
113
|
+
name="{{ constraint.name }}",
|
|
114
|
+
{% if constraint.nulls_not_distinct %}
|
|
115
|
+
postgresql_nulls_not_distinct=True,
|
|
116
|
+
{% endif %}
|
|
117
|
+
),
|
|
118
|
+
{% endfor %}
|
|
108
119
|
{% for idx in table.indexes %}
|
|
109
120
|
{% if idx.unique and not idx.where %}
|
|
110
121
|
UniqueConstraint(
|
|
@@ -205,7 +216,7 @@ class {{ table.class_name }}({{ base_class }}):
|
|
|
205
216
|
|
|
206
217
|
__tablename__ = "{{ table.table }}" # type: ignore[assignment]
|
|
207
218
|
|
|
208
|
-
{% set has_table_level_args = (table.indexes and (table.indexes | length > 0)) or (table.pk_constraint and table.pk_constraint.columns) or (table.check_constraints and (table.check_constraints | length > 0)) %}
|
|
219
|
+
{% set has_table_level_args = (table.indexes and (table.indexes | length > 0)) or (table.unique_constraints and (table.unique_constraints | length > 0)) or (table.pk_constraint and table.pk_constraint.columns) or (table.check_constraints and (table.check_constraints | length > 0)) %}
|
|
209
220
|
{% if has_table_level_args %}
|
|
210
221
|
__table_args__ = (
|
|
211
222
|
{% if table.pk_constraint and table.pk_constraint.columns %}
|
|
@@ -219,6 +230,17 @@ class {{ table.class_name }}({{ base_class }}):
|
|
|
219
230
|
{% for check in table.check_constraints %}
|
|
220
231
|
CheckConstraint("{{ check.expression | replace('"', '\\"') }}", name="{{ check.name }}"),
|
|
221
232
|
{% endfor %}
|
|
233
|
+
{% for constraint in table.unique_constraints %}
|
|
234
|
+
UniqueConstraint(
|
|
235
|
+
{% for c in constraint.columns %}
|
|
236
|
+
"{{ c }}",
|
|
237
|
+
{% endfor %}
|
|
238
|
+
name="{{ constraint.name }}",
|
|
239
|
+
{% if constraint.nulls_not_distinct %}
|
|
240
|
+
postgresql_nulls_not_distinct=True,
|
|
241
|
+
{% endif %}
|
|
242
|
+
),
|
|
243
|
+
{% endfor %}
|
|
222
244
|
{% for idx in table.indexes %}
|
|
223
245
|
{% if idx.where and idx.unique %}
|
|
224
246
|
Index(
|
package/bin/dbspec/dbspec
CHANGED
|
Binary file
|
package/package.json
CHANGED