Skip to content

Commit 50db95a

Browse files
authored
Add MySQL blob types support and test cases for issue #62 (#74)
* Add MySQL blob types support and test cases for issue #62 - Add tinyblob, blob, mediumblob, longblob to binary_types mapping - Add test_mysql_blob_types: verifies blob types map to bytes - Add test_mysql_all_common_types: comprehensive MySQL type coverage - Add test_mysql_default_null: verifies DEFAULT NULL handling for temporal types - Add CHANGELOG.md in Keep a Changelog format with full version history - Update README.md with link to CHANGELOG.md Relates to #62 * Add GitHub Pages promo site with interactive demo - Add docs/index.html with interactive demo page: - Visual DDL to Python models conversion demo - Switchable output formats (pydantic, pydantic_v2, sqlalchemy, sqlmodel, dataclass) - Supported model types showcase - Quick start guide (3 steps) - Features overview - Dark theme with syntax highlighting - Add GitHub Pages deployment to CI/CD pipeline: - Deploys on push to main after tests pass - Uses actions/deploy-pages@v4 - Update README with link to interactive demo * Add disclaimer about Web UI version
1 parent 229a0d3 commit 50db95a

File tree

7 files changed

+1229
-222
lines changed

7 files changed

+1229
-222
lines changed

.github/workflows/main.yml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,30 @@ jobs:
5252
with:
5353
files: ./coverage.xml
5454
fail_ci_if_error: false
55-
verbose: true
55+
verbose: true
56+
57+
deploy-pages:
58+
runs-on: ubuntu-latest
59+
needs: [tests]
60+
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
61+
permissions:
62+
contents: read
63+
pages: write
64+
id-token: write
65+
environment:
66+
name: github-pages
67+
url: ${{ steps.deployment.outputs.page_url }}
68+
steps:
69+
- uses: actions/checkout@v4
70+
71+
- name: Setup Pages
72+
uses: actions/configure-pages@v4
73+
74+
- name: Upload artifact
75+
uses: actions/upload-pages-artifact@v3
76+
with:
77+
path: './docs'
78+
79+
- name: Deploy to GitHub Pages
80+
id: deployment
81+
uses: actions/deploy-pages@v4

CHANGELOG.md

Lines changed: 290 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,290 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [1.0.0] - 2025-01-18
9+
10+
### Breaking Changes
11+
12+
- Dropped support for Python 3.7 and 3.8
13+
- Minimum required Python version is now 3.9
14+
15+
### Added
16+
17+
**Pydantic v2 Support**
18+
- New `pydantic_v2` models type with native Pydantic v2 syntax
19+
- Uses `X | None` instead of `Optional[X]`
20+
- Uses `dict | list` for JSON/JSONB types instead of `Json`
21+
- Adds `from __future__ import annotations` for Python 3.9 compatibility
22+
- Nullable fields automatically get `= None` default
23+
24+
**OpenAPI 3 (Swagger) Support**
25+
- Generate OpenAPI 3 schemas from DDL: `create_models(ddl, models_type="openapi3")`
26+
- Convert OpenAPI 3 schemas to Python models: `create_models_from_openapi3(schema)`
27+
- Supports JSON and YAML input (with pyyaml)
28+
29+
**Plugin System for Custom Generators**
30+
- `register_generator()` - register custom generator
31+
- `unregister_generator()` - remove custom generator
32+
- `list_generators()` - list all available generators
33+
- Base classes: `BaseGenerator`, `ORMGenerator`, `DataModelGenerator`
34+
- `TypeConverter` class for type mappings
35+
- Entry points support for auto-discovery
36+
- See examples: `example/custom_generator.py`, `example/extend_builtin_generator.py`
37+
38+
**Pydantic Improvements**
39+
- Field alias support for invalid Python identifiers
40+
- Handle Pydantic reserved names (copy, parse_obj, schema, etc.)
41+
- Support for generated columns (`GENERATED ALWAYS AS`) with `exclude=True`
42+
- `table_prefix` and `table_suffix` parameters for class name customization
43+
- Boolean defaults 0/1 converted to False/True
44+
- Expanded `datetime_now_check` with more SQL datetime keywords
45+
46+
**SQLModel Improvements**
47+
- Fixed array type generation (issue #66)
48+
- Arrays now properly generate `List[T]` with correct SQLAlchemy ARRAY type
49+
- Added `typing_imports` support for List import
50+
- Added `pydantic_to_sa_fallback` mapping for array element types
51+
52+
**MySQL Support**
53+
- Added blob types support: `tinyblob`, `blob`, `mediumblob`, `longblob` map to `bytes` (issue #62)
54+
55+
**Other**
56+
- Added support for Python 3.12 and 3.13
57+
- Added tox configuration for local multi-version testing (py39-py313)
58+
- Added pytest-cov for code coverage reporting
59+
60+
### Changed
61+
62+
- Simplified datetime imports (`from datetime import datetime` instead of `import datetime`)
63+
- Use `Any` type instead of `Json` for json/jsonb columns in Pydantic
64+
- Enum generation now uses functional syntax: `Enum(value='Name', names=[...])`
65+
- Updated GitHub Actions workflow with latest action versions (checkout@v4, setup-python@v5)
66+
- Updated py-models-parser to version 1.0.0
67+
- Reorganized types module with TypeConverter class
68+
69+
### Fixed
70+
71+
- Fixed `iterate_over_the_list()` modifying list during iteration
72+
- Fixed meaningless condition in dataclass generator
73+
- Fixed incorrect column type crash (PR #63)
74+
- Fixed enums including whitespace in values (issue #69)
75+
- Fixed boolean values capitalization - now generates `True`/`False` instead of `true`/`false` (PR #67)
76+
- Fixed SQLModel array type generation TypeError (issue #66)
77+
- Fixed MySQL blob types not mapping to `bytes` (issue #62)
78+
79+
### Documentation
80+
81+
- Added ARCHITECTURE.md with project documentation
82+
- Updated documentation with Pydantic v2 examples
83+
84+
## [0.17.0]
85+
86+
### Fixed
87+
88+
- Fix character varying type (issue #59)
89+
90+
### Changed
91+
92+
- SQLAlchemy import removed from generation in SQLModels if it is not used
93+
- `= Field()` is not placed in SQLModel if there is no defaults or other settings
94+
95+
## [0.16.0]
96+
97+
### Added
98+
99+
- Initial SQLModel Support
100+
101+
## [0.15.1]
102+
103+
### Changed
104+
105+
- Foreign Key processing updates (PR #55)
106+
- Move to simple-ddl-parser version 1.X
107+
108+
## [0.14.0]
109+
110+
### Added
111+
112+
- Python 3.11 support
113+
114+
## [0.13.0]
115+
116+
### Added
117+
118+
- Added argument `schema_global=` to support SQLAlchemy & Gino different table schemas (issue #41)
119+
120+
## [0.12.1]
121+
122+
### Fixed
123+
124+
- `current_timestamp` function processed now same way as `now()` function from DDL
125+
126+
## [0.12.0]
127+
128+
### Fixed
129+
130+
- Named arguments always go after positional (issue #35)
131+
132+
### Added
133+
134+
- Availability to disable auto-name conversion (issue #36)
135+
- `no_auto_snake_case=True` keeps names 1-to-1 as in DDL file
136+
137+
## [0.11.1]
138+
139+
### Added
140+
141+
- Added bytes type to pydantic (PR #31)
142+
143+
### Changed
144+
145+
- Parser version updated to the latest
146+
147+
## [0.11.0]
148+
149+
### Fixed
150+
151+
- MSSQL column & table names in `[]` now parsed validly (issue #28)
152+
- Names like `users_WorkSchedule` now converted correctly to PascalCase
153+
154+
## [0.10.1]
155+
156+
### Changed
157+
158+
- Update simple-ddl-parser version to 0.21.2
159+
160+
## [0.10.0]
161+
162+
### Changed
163+
164+
- Meta models moved to separate package (table-meta)
165+
- `common` module renamed to `from_ddl`
166+
167+
### Fixed
168+
169+
- Fixed bugs in converter (still in beta)
170+
- Can generate Enum models if DDL has only CREATE TYPE statements
171+
- String enums now inherit from `(str, Enum)` in all model types
172+
173+
### Added
174+
175+
- Converter feature to convert one model type to another (excluding SQLAlchemy Core Tables)
176+
177+
## [0.9.0]
178+
179+
### Added
180+
181+
- Beta models converter from one type of models to another
182+
- If O!MyModels does not know how to convert type - leaves it as is
183+
184+
### Fixed
185+
186+
- In Dataclass & Pydantic generators Decimals & Floats converted to float (previously was int)
187+
188+
## [0.8.4]
189+
190+
### Changed
191+
192+
- If tables not found in DDL - raises NoTable error
193+
- Added `exit_silent` flag for silent exit if no tables
194+
195+
## [0.8.3]
196+
197+
### Added
198+
199+
- TableMetaModel class for unified metadata parsing
200+
201+
### Fixed
202+
203+
- `NOW()` recognized as `now()` (issue #18)
204+
- Default value of `now()` uses field for dataclass (issue #19)
205+
206+
## [0.8.1]
207+
208+
### Fixed
209+
210+
- Parser version updated (fixed several issues)
211+
- Fixed Unique Constraint after schema in SQLAlchemy Core
212+
213+
## [0.8.0]
214+
215+
### Fixed
216+
217+
- `--defaults-off` flag in CLI
218+
219+
### Added
220+
221+
- Support for SQLAlchemy Core Tables generating
222+
- Added examples folder
223+
224+
### Fixed
225+
226+
- ForeignKey in SQLAlchemy
227+
228+
## [0.7.0]
229+
230+
### Added
231+
232+
- SQLAlchemy models generation (defaults as 'server_default')
233+
- Defaults for Pydantic models
234+
- `defaults_off=True` flag and `--defaults-off` CLI flag
235+
236+
### Fixed
237+
238+
- Enum types with lower case names in DDLs
239+
- Dataclass generation issues (default with datetime & Enums)
240+
- Quotes not removed from defaults
241+
242+
## [0.6.0]
243+
244+
### Added
245+
246+
- Python Dataclass generation from DDL
247+
- ForeignKey generation to GinoORM Models with ondelete/onupdate support
248+
249+
## [0.5.0]
250+
251+
### Added
252+
253+
- Enums/IntEnums types for Gino & Pydantic
254+
- UUID type
255+
- `schema_global` key (default True)
256+
- `--no-global-schema` CLI flag
257+
258+
### Changed
259+
260+
- Primary key columns don't show nullable argument
261+
262+
## [0.4.1]
263+
264+
### Fixed
265+
266+
- Table names containing multiple '-'
267+
268+
## [0.4.0]
269+
270+
### Added
271+
272+
- Pydantic models generation from DDL
273+
274+
### Changed
275+
276+
- `create_gino_models` renamed to `create_models`
277+
278+
## [0.3.0]
279+
280+
### Fixed
281+
282+
- Generated Index for 'index' statement (not unique constraint)
283+
- Column size as tuple (4,2)
284+
285+
## [0.2.0]
286+
287+
### Added
288+
289+
- Valid generating columns: autoincrement, default, type, arrays, unique, primary key
290+
- Creating `__table_args__` for indexes

0 commit comments

Comments
 (0)