orm-database 0.3.14__tar.gz → 0.3.16__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {orm_database-0.3.14 → orm_database-0.3.16}/PKG-INFO +1 -1
- {orm_database-0.3.14 → orm_database-0.3.16}/orm_database/orm_database.py +0 -5
- {orm_database-0.3.14 → orm_database-0.3.16}/orm_database/orm_query.py +18 -12
- {orm_database-0.3.14 → orm_database-0.3.16}/orm_database.egg-info/PKG-INFO +1 -1
- {orm_database-0.3.14 → orm_database-0.3.16}/setup.py +1 -1
- {orm_database-0.3.14 → orm_database-0.3.16}/LICENSE +0 -0
- {orm_database-0.3.14 → orm_database-0.3.16}/README.md +0 -0
- {orm_database-0.3.14 → orm_database-0.3.16}/orm_database/__init__.py +0 -0
- {orm_database-0.3.14 → orm_database-0.3.16}/orm_database.egg-info/SOURCES.txt +0 -0
- {orm_database-0.3.14 → orm_database-0.3.16}/orm_database.egg-info/dependency_links.txt +0 -0
- {orm_database-0.3.14 → orm_database-0.3.16}/orm_database.egg-info/requires.txt +0 -0
- {orm_database-0.3.14 → orm_database-0.3.16}/orm_database.egg-info/top_level.txt +0 -0
- {orm_database-0.3.14 → orm_database-0.3.16}/setup.cfg +0 -0
@@ -100,7 +100,6 @@ class PostgreSQL:
|
|
100
100
|
try:
|
101
101
|
query=query_baseModel_create_table(table,class_BaseModel)
|
102
102
|
await self.db.execute(query)
|
103
|
-
await self.db.close()
|
104
103
|
return True
|
105
104
|
except:
|
106
105
|
return False
|
@@ -108,20 +107,17 @@ class PostgreSQL:
|
|
108
107
|
async def teble_create(self, table: str, field: dict):
|
109
108
|
query=query_create_table(table,field)
|
110
109
|
await self.db.execute(query)
|
111
|
-
await self.db.close()
|
112
110
|
|
113
111
|
|
114
112
|
async def insert_value(self, table: str, value: dict):
|
115
113
|
query = query_insert_value(table,value)
|
116
114
|
await self.db.execute(query)
|
117
|
-
await self.db.close()
|
118
115
|
|
119
116
|
|
120
117
|
async def insert_values(self, table: str, values: list):
|
121
118
|
for value in values:
|
122
119
|
query = query_insert_values(table=table,value=value)
|
123
120
|
await self.db.execute(query)
|
124
|
-
await self.db.close()
|
125
121
|
|
126
122
|
async def select_all(self, table: str, filed: list, all: bool = False):
|
127
123
|
if all == True:
|
@@ -145,7 +141,6 @@ class PostgreSQL:
|
|
145
141
|
data[filed[conter]] = b
|
146
142
|
conter += 1
|
147
143
|
data_row.append(dict(data))
|
148
|
-
await self.db.close()
|
149
144
|
print(data_row)
|
150
145
|
return data_row
|
151
146
|
|
@@ -1,8 +1,10 @@
|
|
1
1
|
def query_baseModel_create_table(table,class_BaseModel):
|
2
2
|
query = f"CREATE TABLE {table} ("
|
3
3
|
result=class_BaseModel.model_json_schema()
|
4
|
+
list_keys = result['properties']
|
5
|
+
list_keys = list(list_keys.keys())
|
4
6
|
type=""
|
5
|
-
for a in
|
7
|
+
for a in list_keys:
|
6
8
|
data = result['properties'][a]
|
7
9
|
if len(data.keys()) == 2:
|
8
10
|
match data["type"]:
|
@@ -16,17 +18,21 @@ def query_baseModel_create_table(table,class_BaseModel):
|
|
16
18
|
type = "bool"
|
17
19
|
query = query + a + " " + type + ","
|
18
20
|
else :
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
21
|
+
try:
|
22
|
+
type = data["default"]
|
23
|
+
query = query + a + " " + type + ","
|
24
|
+
except:
|
25
|
+
match data["type"]:
|
26
|
+
case "string":
|
27
|
+
type = f"varchar({data["varchar"]})"
|
28
|
+
case "number":
|
29
|
+
type = "float"
|
30
|
+
case "integer":
|
31
|
+
type = "int"
|
32
|
+
case "boolean":
|
33
|
+
type = "bool"
|
34
|
+
|
35
|
+
query = query + a + " " + type + ","
|
30
36
|
query = query[:-1]
|
31
37
|
query = query + ")"
|
32
38
|
return query
|
@@ -6,7 +6,7 @@ long_description = (this_directory / "README.md").read_text()
|
|
6
6
|
|
7
7
|
setup(
|
8
8
|
name='orm_database',
|
9
|
-
version='0.3.
|
9
|
+
version='0.3.16',
|
10
10
|
description='This module is written to launch your programs with any database you want in the shortest time ',
|
11
11
|
license="MIT",
|
12
12
|
author='SISRSIS',
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|