orm-database 0.3.12__tar.gz → 0.3.14__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: orm_database
3
- Version: 0.3.12
3
+ Version: 0.3.14
4
4
  Summary: This module is written to launch your programs with any database you want in the shortest time
5
5
  Home-page: https://github.com/sisrsis/orm-database
6
6
  Author: SISRSIS
@@ -97,10 +97,13 @@ class PostgreSQL:
97
97
 
98
98
 
99
99
  async def teble_create_BaseModel(self,table:str , class_BaseModel):
100
- query=query_baseModel_create_table(table,class_BaseModel)
101
- await self.db.execute(query)
102
- await self.db.close()
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)
@@ -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
- try :
9
- maxLength = data['maxLength']
10
- match data['type']:
11
- case 'integer':
12
- types = 'int'
13
- case 'boolean':
14
- types = 'bool'
15
- case 'number':
16
- types = 'float'
17
- case 'string':
18
- types = 'varchar'
19
- if types == 'varchar':
20
- uint = str(a)+" "+types+"("+data["varchar"]+")"+'('+str(maxLength)+')'
21
- query = query + " " + uint + " ,"
22
- else:
23
- uint = str(a)+" "+types+'('+str(maxLength)+')'
24
- query = query + " " + uint + " ,"
25
- except :
26
- match data['type']:
27
- case 'integer':
28
- types = 'int'
29
- case 'boolean':
30
- types = 'bool'
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: orm_database
3
- Version: 0.3.12
3
+ Version: 0.3.14
4
4
  Summary: This module is written to launch your programs with any database you want in the shortest time
5
5
  Home-page: https://github.com/sisrsis/orm-database
6
6
  Author: SISRSIS
@@ -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.12',
9
+ version='0.3.14',
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