Commit d1d6300
authored
initial prototype for auto schema generation (piccolo-orm#157)
* initial prototype for auto schema generation
* make sure the correct column type is being instantiated
* use black to nicely format the string
* add Timestamptz
* detect if column is nullable
* introspect Varchar length
* slight refactor, and output required imports
* added initial tests
* fix tests
* remove some kwargs from output
* fix bug with duplicate id columns
* add extra imports if foreign keys are present
* add docs
* fixing a bug with primary key detection
* add test for unique constraints
* log the db version instead of printing to avoid adding noise to output
Otherwise if someone pipes `piccolo schema generate` straight to a file, it won't be valid Python as it'll have something like 'Running Postgres version 9.6' at the top.
* increase code coverage
* add a link from the schema docs to the `piccolo schema generate` docs1 parent 3218432 commit d1d6300
File tree
14 files changed
+575
-2
lines changed- docs/src/piccolo
- projects_and_apps
- schema
- piccolo
- apps/schema
- commands
- engine
- utils
- requirements
- tests
- apps/schema
- commands
14 files changed
+575
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
63 | 80 | | |
64 | 81 | | |
65 | 82 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
24 | 28 | | |
25 | 29 | | |
26 | 30 | | |
| |||
Whitespace-only changes.
Whitespace-only changes.
0 commit comments