slinn-orm 0.0.6__tar.gz → 0.0.7__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: slinn-orm
3
- Version: 0.0.6
3
+ Version: 0.0.7
4
4
  Summary: ORM for Slinn
5
5
  Author-email: Mark Radin <openmiot@gmail.com>
6
6
  Requires-Python: >=3.14
@@ -160,12 +160,11 @@ class PostgresConnection(ConnectionProtocol):
160
160
  self._connection = connection
161
161
  self._transaction = transaction
162
162
  self._autocommit = autocommit
163
- self._models = set()
164
163
  self.collection = self.__getattr__
165
164
 
166
165
  def __getattr__(self, key) -> CollectionProtocol:
167
166
  return PostgresCollection(
168
- self, key, model = next(iter(model for model in self._models if model.__collection_name__() == key))
167
+ self, key, model = next(iter(model for model in self._pool._models if model.__collection_name__() == key))
169
168
  )
170
169
 
171
170
  async def rollback(self) -> None:
@@ -205,7 +204,7 @@ class PostgresConnection(ConnectionProtocol):
205
204
  {f'PRIMARY KEY ({','.join(model._meta_primary_keys)})' if model._meta_primary_keys else ''}
206
205
  );
207
206
  '''.strip())
208
- self._models.add(model)
207
+ self._pool._models.add(model)
209
208
 
210
209
  async def create_index(
211
210
  self,
@@ -258,7 +257,8 @@ class PostgresPool(PoolProtocol):
258
257
  self._pool_factory = pool_factory
259
258
  self._autocommit = autocommit
260
259
  self._pool = None
261
- self._tasks = []
260
+ self._tasks = []
261
+ self._models = set()
262
262
 
263
263
  async def acquire(self) -> PostgresConnection:
264
264
  if not self._pool:
@@ -197,12 +197,11 @@ class SQLiteConnection(ConnectionProtocol):
197
197
  self._connection = connection
198
198
  self._autocommit = autocommit
199
199
  self._in_transaction = False
200
- self._models = set()
201
200
  self.collection = self.__getattr__
202
201
 
203
202
  def __getattr__(self, key) -> CollectionProtocol:
204
203
  return SQLiteCollection(
205
- self, key, model = next(iter(model for model in self._models if model.__collection_name__() == key))
204
+ self, key, model = next(iter(model for model in self._pool._models if model.__collection_name__() == key))
206
205
  )
207
206
 
208
207
  async def rollback(self) -> None:
@@ -244,7 +243,7 @@ class SQLiteConnection(ConnectionProtocol):
244
243
  {f',PRIMARY KEY ({','.join(model._meta_primary_keys)})' if len(model._meta_primary_keys) > 1 else ''}
245
244
  );
246
245
  '''.strip())
247
- self._models.add(model)
246
+ self._pool._models.add(model)
248
247
 
249
248
  async def create_index(
250
249
  self,
@@ -252,8 +251,8 @@ class SQLiteConnection(ConnectionProtocol):
252
251
  collection_name: str,
253
252
  fields: tuple[str],
254
253
  *,
255
- exists_ok: bool=False,
256
- unique: bool=False
254
+ exists_ok: bool = False,
255
+ unique: bool = False
257
256
  ) -> None:
258
257
  print(f"""
259
258
  CREATE {'UNIQUE ' if unique else ''}INDEX {'IF NOT EXISTS ' if exists_ok else ''}{index_name} ON {collection_name}({','.join(fields)});
@@ -310,6 +309,7 @@ class SQLitePool(PoolProtocol):
310
309
  self._lock = asyncio.Lock()
311
310
  self._tasks: list[Coroutine[Any, Any, Any]] = []
312
311
  self._closed = False
312
+ self._models = set()
313
313
 
314
314
  async def acquire(self) -> SQLiteConnection:
315
315
  async with self._lock:
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "slinn-orm"
7
- version = "0.0.6"
7
+ version = "0.0.7"
8
8
  description = "ORM for Slinn"
9
9
  requires-python = ">=3.14"
10
10
  authors = [{ name = "Mark Radin", email = "openmiot@gmail.com" }]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: slinn-orm
3
- Version: 0.0.6
3
+ Version: 0.0.7
4
4
  Summary: ORM for Slinn
5
5
  Author-email: Mark Radin <openmiot@gmail.com>
6
6
  Requires-Python: >=3.14
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes