You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/README.rst
+54-9Lines changed: 54 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,20 @@ Py-Models-Parser
21
21
22
22
23
23
It's as second Parser that done by me, first is a https://github.com/xnuinside/simple-ddl-parser for SQL DDL with different dialects.
24
-
Py-Models-Parser supports now ORM Sqlalchemy, Gino, Tortoise; Pydantic, Python Enum models, Dataclasses & in nearest feature I plan to add pure pyton classes. And next will be added other ORMs models.
24
+
25
+
Py-Models-Parser can parse & extract information from models:
26
+
27
+
28
+
* Sqlalchemy ORM,
29
+
* Gino ORM,
30
+
* Tortoise ORM,
31
+
* Django ORM Model,
32
+
* Pydantic,
33
+
* Python Enum,
34
+
* Python Dataclasses
35
+
* pure Python Classes
36
+
37
+
Number of supported models will be increased, check 'TODO' section.
25
38
26
39
Py-Models-Parser written with PEG parser and it's python implementation - parsimonious. It's pretty new and I did not cover all possible test cases, so if you will have an issue - please just open an issue in this case with example, I will fix it as soon as possible.
27
40
@@ -69,7 +82,8 @@ How to use
69
82
70
83
Library detect automaticaly that type of models you tries to parse. You can check a lot of examples in test/ folder on the GitHub
71
84
72
-
You can parse models from python string:
85
+
86
+
#. You can parse models from python string:
73
87
74
88
.. code-block:: python
75
89
@@ -92,7 +106,8 @@ You can parse models from python string:
92
106
"""
93
107
result = parse(models_str)
94
108
95
-
or just provide the path to file:
109
+
110
+
#. Parse models from file:
96
111
97
112
.. code-block:: python
98
113
@@ -104,7 +119,31 @@ or just provide the path to file:
104
119
# for example: tests/data/dataclass_defaults.py
105
120
result = parse_from_file(file_path)
106
121
107
-
It will produce the result:
122
+
123
+
#. Parse models from file with command line
124
+
125
+
.. code-block:: bash
126
+
127
+
128
+
pmp path_to_models.py
129
+
130
+
# for example: pmp tests/data/dataclass_defaults.py
131
+
132
+
Output from cli can be dumped in 'output_models.json' file - use flag '-d' '--dump' if you want to change target file name, provide it after argument like '-d target_file.json'
133
+
134
+
.. code-block:: bash
135
+
136
+
137
+
# example how to dump output from cli
138
+
139
+
pmp path_to_models.py -d target_file.json
140
+
141
+
Output example
142
+
^^^^^^^^^^^^^^
143
+
144
+
You can find a lot of output examples in tests - https://github.com/xnuinside/py-models-parser/tree/main/tests
145
+
146
+
For model from point 1 (above) library will produce the result:
108
147
109
148
.. code-block:: python
110
149
@@ -153,15 +192,21 @@ TODO: in next Release
153
192
---------------------
154
193
155
194
156
-
#. Parse from file method
157
-
#. Add cli
158
-
#. Add more tests for supported models (and fix existed not covered cases): Pydantic, Enums, Dataclasses, SQLAlchemy Models, GinoORM models, TortoiseORM models
159
-
#. Add support for pure Python classes
160
-
#. Add support for pure SQLAlchemy Core Tables
195
+
#. Add more tests for supported models (and fix existed not covered cases): Django ORM, Pydantic, Enums, Dataclasses, SQLAlchemy Models, GinoORM models, TortoiseORM models
196
+
#. Add support for SQLAlchemy Core Tables
197
+
#. Add support for Pony ORM models
198
+
#. Add support for Piccolo ORM models
161
199
162
200
Changelog
163
201
---------
164
202
203
+
**v0.3.0**
204
+
205
+
206
+
#. Added cli - ``pmp`` command with args -d, --dump
0 commit comments