postgresdb3 1.0.2__tar.gz → 1.0.4__tar.gz
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.
- {postgresdb3-1.0.2 → postgresdb3-1.0.4}/PKG-INFO +1 -1
- {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3/orm/models.py +0 -44
- {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3/orm/query.py +10 -2
- {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3.egg-info/PKG-INFO +1 -1
- {postgresdb3-1.0.2 → postgresdb3-1.0.4}/setup.py +1 -1
- {postgresdb3-1.0.2 → postgresdb3-1.0.4}/README.md +0 -0
- {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3/__init__.py +0 -0
- {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3/cli.py +0 -0
- {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3/core/__init__.py +0 -0
- {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3/core/async_db.py +0 -0
- {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3/core/sync_db.py +0 -0
- {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3/migrations/__init__.py +0 -0
- {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3/migrations/engine.py +0 -0
- {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3/orm/__init__.py +0 -0
- {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3/orm/base.py +0 -0
- {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3/orm/expressions.py +0 -0
- {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3/orm/fields/__init__.py +0 -0
- {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3/orm/fields/base.py +0 -0
- {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3/orm/fields/datetime.py +0 -0
- {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3/orm/fields/foreign.py +0 -0
- {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3/orm/fields/misc.py +0 -0
- {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3/orm/fields/numeric.py +0 -0
- {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3/orm/fields/text.py +0 -0
- {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3/orm/meta.py +0 -0
- {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3/orm/relations.py +0 -0
- {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3.egg-info/SOURCES.txt +0 -0
- {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3.egg-info/dependency_links.txt +0 -0
- {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3.egg-info/requires.txt +0 -0
- {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3.egg-info/top_level.txt +0 -0
- {postgresdb3-1.0.2 → postgresdb3-1.0.4}/pyproject.toml +0 -0
- {postgresdb3-1.0.2 → postgresdb3-1.0.4}/setup.cfg +0 -0
|
@@ -149,28 +149,6 @@ class Model(BaseModel, metaclass=ModelMeta):
|
|
|
149
149
|
|
|
150
150
|
cls.db._manager(sql, values_list, commit=True, many=True)
|
|
151
151
|
|
|
152
|
-
@classmethod
|
|
153
|
-
def create_table(cls):
|
|
154
|
-
cls._check_setup()
|
|
155
|
-
|
|
156
|
-
columns_sql = []
|
|
157
|
-
has_primary_key = False
|
|
158
|
-
|
|
159
|
-
for field_name, field in cls._fields.items():
|
|
160
|
-
if getattr(field, "primary_key", False):
|
|
161
|
-
has_primary_key = True
|
|
162
|
-
columns_sql.append(field.to_sql())
|
|
163
|
-
|
|
164
|
-
if not has_primary_key:
|
|
165
|
-
columns_sql.insert(0, f"{cls.get_pk_name()} SERIAL PRIMARY KEY")
|
|
166
|
-
|
|
167
|
-
cls.db.create(cls.table, ", ".join(columns_sql))
|
|
168
|
-
|
|
169
|
-
@classmethod
|
|
170
|
-
def drop_table(cls, cascade=False):
|
|
171
|
-
cls._check_setup()
|
|
172
|
-
cls.db.drop(cls.table, cascade=cascade)
|
|
173
|
-
|
|
174
152
|
def save(self):
|
|
175
153
|
self.__class__._check_setup()
|
|
176
154
|
|
|
@@ -385,28 +363,6 @@ class AsyncModel(BaseModel, metaclass=ModelMeta):
|
|
|
385
363
|
|
|
386
364
|
await cls.db._manager(sql, values_list, commit=True, many=True)
|
|
387
365
|
|
|
388
|
-
@classmethod
|
|
389
|
-
async def create_table(cls):
|
|
390
|
-
cls._check_setup()
|
|
391
|
-
|
|
392
|
-
columns_sql = []
|
|
393
|
-
has_primary_key = False
|
|
394
|
-
|
|
395
|
-
for field_name, field in cls._fields.items():
|
|
396
|
-
if getattr(field, "primary_key", False):
|
|
397
|
-
has_primary_key = True
|
|
398
|
-
columns_sql.append(field.to_sql())
|
|
399
|
-
|
|
400
|
-
if not has_primary_key:
|
|
401
|
-
columns_sql.insert(0, f"{cls.get_pk_name()} SERIAL PRIMARY KEY")
|
|
402
|
-
|
|
403
|
-
await cls.db.create(cls.table, ", ".join(columns_sql))
|
|
404
|
-
|
|
405
|
-
@classmethod
|
|
406
|
-
async def drop_table(cls, cascade=False):
|
|
407
|
-
cls._check_setup()
|
|
408
|
-
await cls.db.drop(cls.table, cascade=cascade)
|
|
409
|
-
|
|
410
366
|
async def save(self):
|
|
411
367
|
self.__class__._check_setup()
|
|
412
368
|
|
|
@@ -80,7 +80,11 @@ class QuerySet:
|
|
|
80
80
|
for field_name in fields:
|
|
81
81
|
field = self.model._fields.get(field_name)
|
|
82
82
|
if not field or not hasattr(field, "to"):
|
|
83
|
-
raise ValueError(f"{field_name} ForeignKey
|
|
83
|
+
raise ValueError(f"'{field_name}' xato kiritildi. select_related faqat ForeignKey yoki OneToOneField bilan ishlaydi.")
|
|
84
|
+
|
|
85
|
+
from .fields.foreign import ManyToManyField
|
|
86
|
+
if isinstance(field, ManyToManyField):
|
|
87
|
+
raise TypeError(f"'{field_name}' bu ManyToManyField! Uning uchun select_related() emas, balki prefetch_related() ishlating.")
|
|
84
88
|
|
|
85
89
|
related_table = field.to.table
|
|
86
90
|
on_condition = f"{self.model.table}.{field_name} = {related_table}.{field.to.get_pk_name()}"
|
|
@@ -486,7 +490,11 @@ class AsyncQuerySet:
|
|
|
486
490
|
for field_name in fields:
|
|
487
491
|
field = self.model._fields.get(field_name)
|
|
488
492
|
if not field or not hasattr(field, "to"):
|
|
489
|
-
raise ValueError(f"{field_name} ForeignKey
|
|
493
|
+
raise ValueError(f"'{field_name}' xato kiritildi. select_related faqat ForeignKey yoki OneToOneField bilan ishlaydi.")
|
|
494
|
+
|
|
495
|
+
from .fields.foreign import ManyToManyField
|
|
496
|
+
if isinstance(field, ManyToManyField):
|
|
497
|
+
raise TypeError(f"'{field_name}' bu ManyToManyField! Uning uchun select_related() emas, balki prefetch_related() ishlating.")
|
|
490
498
|
|
|
491
499
|
related_table = field.to.table
|
|
492
500
|
on_condition = f"{self.model.table}.{field_name} = {related_table}.{field.to.get_pk_name()}"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|