orm-database 0.3.12__py3-none-any.whl → 0.3.13__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- orm_database/orm_query.py +24 -31
- {orm_database-0.3.12.dist-info → orm_database-0.3.13.dist-info}/METADATA +1 -1
- orm_database-0.3.13.dist-info/RECORD +8 -0
- orm_database-0.3.12.dist-info/RECORD +0 -8
- {orm_database-0.3.12.dist-info → orm_database-0.3.13.dist-info}/LICENSE +0 -0
- {orm_database-0.3.12.dist-info → orm_database-0.3.13.dist-info}/WHEEL +0 -0
- {orm_database-0.3.12.dist-info → orm_database-0.3.13.dist-info}/top_level.txt +0 -0
orm_database/orm_query.py
CHANGED
@@ -1,39 +1,32 @@
|
|
1
|
-
|
2
|
-
|
3
1
|
def query_baseModel_create_table(table,class_BaseModel):
|
4
2
|
query = f"CREATE TABLE {table} ("
|
5
3
|
result=class_BaseModel.model_json_schema()
|
4
|
+
type=""
|
6
5
|
for a in result['required']:
|
7
6
|
data = result['properties'][a]
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
case
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
case 'number':
|
32
|
-
types = 'float'
|
33
|
-
case 'string':
|
34
|
-
types = 'varchar'
|
35
|
-
uint = str(a)+" "+types +"("+str(data["varchar"])+")"
|
36
|
-
query = query + " " + uint + " ,"
|
7
|
+
if len(data.keys()) == 2:
|
8
|
+
match data["type"]:
|
9
|
+
case "string":
|
10
|
+
type = "varchar"
|
11
|
+
case "number":
|
12
|
+
type = "float"
|
13
|
+
case "integer":
|
14
|
+
type = "int"
|
15
|
+
case "boolean":
|
16
|
+
type = "bool"
|
17
|
+
query = query + a + " " + type + ","
|
18
|
+
else :
|
19
|
+
match data["type"]:
|
20
|
+
case "string":
|
21
|
+
type = f"varchar({data["varchar"]})"
|
22
|
+
case "number":
|
23
|
+
type = "float"
|
24
|
+
case "integer":
|
25
|
+
type = "int"
|
26
|
+
case "boolean":
|
27
|
+
type = "bool"
|
28
|
+
|
29
|
+
query = query + a + " " + type + ","
|
37
30
|
query = query[:-1]
|
38
31
|
query = query + ")"
|
39
32
|
return query
|
@@ -0,0 +1,8 @@
|
|
1
|
+
orm_database/__init__.py,sha256=q0A0dUBMacf_yaU5m4VWCDlP__pVAz3I1Bhn1RPkv9I,140
|
2
|
+
orm_database/orm_database.py,sha256=O8LL_WFy0N0QXK87IdrfY5HKlM3fBnUHJyUT6BN66Kw,7325
|
3
|
+
orm_database/orm_query.py,sha256=yrZfGlt6ZDwyG_skXCHxESCejKjss_8WzKI0ERvxZiI,2840
|
4
|
+
orm_database-0.3.13.dist-info/LICENSE,sha256=v33KAoqx5qhyUNlHOjYmBBKDtd9ymzWB7sR4cova190,1064
|
5
|
+
orm_database-0.3.13.dist-info/METADATA,sha256=I6WBzxGLPgBgTu9GN3_yL_P0ZVl2K-KqssgvSYFhbUc,4986
|
6
|
+
orm_database-0.3.13.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
7
|
+
orm_database-0.3.13.dist-info/top_level.txt,sha256=dzcxzqcdsX4x3lqSkz1tVcu1qKX02rXOu6QN3cHggU4,13
|
8
|
+
orm_database-0.3.13.dist-info/RECORD,,
|
@@ -1,8 +0,0 @@
|
|
1
|
-
orm_database/__init__.py,sha256=q0A0dUBMacf_yaU5m4VWCDlP__pVAz3I1Bhn1RPkv9I,140
|
2
|
-
orm_database/orm_database.py,sha256=O8LL_WFy0N0QXK87IdrfY5HKlM3fBnUHJyUT6BN66Kw,7325
|
3
|
-
orm_database/orm_query.py,sha256=hrNTLjmrUGouMGpVGIFFqPulvbVdzWyxUTf1s_wCfxs,3147
|
4
|
-
orm_database-0.3.12.dist-info/LICENSE,sha256=v33KAoqx5qhyUNlHOjYmBBKDtd9ymzWB7sR4cova190,1064
|
5
|
-
orm_database-0.3.12.dist-info/METADATA,sha256=D10rh7mYW3dUTvbM37sP2s3FoketM2kxyMeIuSXowHY,4986
|
6
|
-
orm_database-0.3.12.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
7
|
-
orm_database-0.3.12.dist-info/top_level.txt,sha256=dzcxzqcdsX4x3lqSkz1tVcu1qKX02rXOu6QN3cHggU4,13
|
8
|
-
orm_database-0.3.12.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|