orm-database 0.3.12__py3-none-any.whl → 0.3.14__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- orm_database/orm_database.py +7 -4
- orm_database/orm_query.py +24 -31
- {orm_database-0.3.12.dist-info → orm_database-0.3.14.dist-info}/METADATA +1 -1
- orm_database-0.3.14.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.14.dist-info}/LICENSE +0 -0
- {orm_database-0.3.12.dist-info → orm_database-0.3.14.dist-info}/WHEEL +0 -0
- {orm_database-0.3.12.dist-info → orm_database-0.3.14.dist-info}/top_level.txt +0 -0
orm_database/orm_database.py
CHANGED
@@ -97,10 +97,13 @@ class PostgreSQL:
|
|
97
97
|
|
98
98
|
|
99
99
|
async def teble_create_BaseModel(self,table:str , class_BaseModel):
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
100
|
+
try:
|
101
|
+
query=query_baseModel_create_table(table,class_BaseModel)
|
102
|
+
await self.db.execute(query)
|
103
|
+
await self.db.close()
|
104
|
+
return True
|
105
|
+
except:
|
106
|
+
return False
|
104
107
|
|
105
108
|
async def teble_create(self, table: str, field: dict):
|
106
109
|
query=query_create_table(table,field)
|
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=-hb8CWvrXAN8q6rNn3gMJ_LgfVAYsSoT9vR9G0k01nU,7417
|
3
|
+
orm_database/orm_query.py,sha256=yrZfGlt6ZDwyG_skXCHxESCejKjss_8WzKI0ERvxZiI,2840
|
4
|
+
orm_database-0.3.14.dist-info/LICENSE,sha256=v33KAoqx5qhyUNlHOjYmBBKDtd9ymzWB7sR4cova190,1064
|
5
|
+
orm_database-0.3.14.dist-info/METADATA,sha256=qUeLW-queNWGOXUBvDxb1XUbTkDweBtFBzwoB1KRueY,4986
|
6
|
+
orm_database-0.3.14.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
7
|
+
orm_database-0.3.14.dist-info/top_level.txt,sha256=dzcxzqcdsX4x3lqSkz1tVcu1qKX02rXOu6QN3cHggU4,13
|
8
|
+
orm_database-0.3.14.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
|