Skip to content

Commit 4e9cba5

Browse files
committed
Initial code, spec and test, pushing for review
1 parent 20db964 commit 4e9cba5

File tree

8 files changed

+1164
-78
lines changed

8 files changed

+1164
-78
lines changed

dbldatagen/spec/compat.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,25 @@
77

88
except ImportError:
99
# This will be executed on environments with only Pydantic V1.x
10-
from pydantic import BaseModel, Field, validator, constr
10+
from pydantic import BaseModel, Field, validator, constr, root_validator, field_validator
1111

1212
# In your application code, do this:
1313
# from .compat import BaseModel
1414
# NOT this:
1515
# from pydantic import BaseModel
1616

1717
# FastAPI Notes
18-
# https://github.com/fastapi/fastapi/blob/master/fastapi/_compat.py
18+
# https://github.com/fastapi/fastapi/blob/master/fastapi/_compat.py
19+
20+
21+
"""
22+
## Why This Approach
23+
No Installation Required: It directly addresses your core requirement.
24+
You don't need to %pip install anything, which avoids conflicts with the pre-installed libraries on Databricks.
25+
Single Codebase: You maintain one set of code that is guaranteed to work with the Pydantic V1 API, which is available in both runtimes.
26+
27+
Environment Agnostic: Your application code in models.py has no idea which version of Pydantic is actually installed. The compat.py module handles that complexity completely.
28+
29+
Future-Ready: When you eventually decide to migrate fully to the Pydantic V2 API (to take advantage of its speed and features),
30+
you only need to change your application code and your compat.py import statements, making the transition much clearer.
31+
"""

dbldatagen/spec/generator.py

Lines changed: 0 additions & 69 deletions
This file was deleted.

0 commit comments

Comments
 (0)