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.
Files changed (31) hide show
  1. {postgresdb3-1.0.2 → postgresdb3-1.0.4}/PKG-INFO +1 -1
  2. {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3/orm/models.py +0 -44
  3. {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3/orm/query.py +10 -2
  4. {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3.egg-info/PKG-INFO +1 -1
  5. {postgresdb3-1.0.2 → postgresdb3-1.0.4}/setup.py +1 -1
  6. {postgresdb3-1.0.2 → postgresdb3-1.0.4}/README.md +0 -0
  7. {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3/__init__.py +0 -0
  8. {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3/cli.py +0 -0
  9. {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3/core/__init__.py +0 -0
  10. {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3/core/async_db.py +0 -0
  11. {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3/core/sync_db.py +0 -0
  12. {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3/migrations/__init__.py +0 -0
  13. {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3/migrations/engine.py +0 -0
  14. {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3/orm/__init__.py +0 -0
  15. {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3/orm/base.py +0 -0
  16. {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3/orm/expressions.py +0 -0
  17. {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3/orm/fields/__init__.py +0 -0
  18. {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3/orm/fields/base.py +0 -0
  19. {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3/orm/fields/datetime.py +0 -0
  20. {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3/orm/fields/foreign.py +0 -0
  21. {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3/orm/fields/misc.py +0 -0
  22. {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3/orm/fields/numeric.py +0 -0
  23. {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3/orm/fields/text.py +0 -0
  24. {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3/orm/meta.py +0 -0
  25. {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3/orm/relations.py +0 -0
  26. {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3.egg-info/SOURCES.txt +0 -0
  27. {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3.egg-info/dependency_links.txt +0 -0
  28. {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3.egg-info/requires.txt +0 -0
  29. {postgresdb3-1.0.2 → postgresdb3-1.0.4}/postgresdb3.egg-info/top_level.txt +0 -0
  30. {postgresdb3-1.0.2 → postgresdb3-1.0.4}/pyproject.toml +0 -0
  31. {postgresdb3-1.0.2 → postgresdb3-1.0.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: postgresdb3
3
- Version: 1.0.2
3
+ Version: 1.0.4
4
4
  Summary: High-Performance Sync and Async PostgreSQL ORM for Python
5
5
  Author: Abdulbosit Alijonov
6
6
  Project-URL: Source Code, https://github.com/AlijonovUz/PostgresDB
@@ -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 emas yoki topilmadi")
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 emas yoki topilmadi")
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()}"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: postgresdb3
3
- Version: 1.0.2
3
+ Version: 1.0.4
4
4
  Summary: High-Performance Sync and Async PostgreSQL ORM for Python
5
5
  Author: Abdulbosit Alijonov
6
6
  Project-URL: Source Code, https://github.com/AlijonovUz/PostgresDB
@@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as f:
5
5
 
6
6
  setup(
7
7
  name="postgresdb3",
8
- version="1.0.2",
8
+ version="1.0.4",
9
9
  packages=find_packages(),
10
10
  install_requires=[
11
11
  "psycopg2>=2.9",
File without changes
File without changes
File without changes