File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 383383 " \n " ,
384384 " self.pool = await asyncpg.create_pool(dsn=self.service_url, init=init)\n " ,
385385 " return self.pool.acquire()\n " ,
386+ " \n " ,
387+ " async def close(self):\n " ,
388+ " if self.pool != None:\n " ,
389+ " await self.pool.close()\n " ,
386390 " \n " ,
387391 " async def table_is_empty(self):\n " ,
388392 " \"\"\"\n " ,
783787 " await vec.delete_all()\n " ,
784788 " assert await vec.table_is_empty()\n " ,
785789 " \n " ,
786- " await vec.drop_table()"
790+ " await vec.drop_table()\n " ,
791+ " await vec.close()"
787792 ]
788793 },
789794 {
848853 " finally: \n " ,
849854 " self.pool.putconn(connection)\n " ,
850855 " \n " ,
856+ " def close(self):\n " ,
857+ " if self.pool != None:\n " ,
858+ " self.pool.closeall()\n " ,
859+ " \n " ,
851860 " def _translate_to_pyformat(self, query_string, params):\n " ,
852861 " \"\"\"\n " ,
853862 " Translates dollar sign number parameters and list parameters to pyformat strings.\n " ,
13271336 " vec.delete_all()\n " ,
13281337 " assert vec.table_is_empty()\n " ,
13291338 " \n " ,
1330- " vec.drop_table()"
1339+ " vec.drop_table()\n " ,
1340+ " \n " ,
1341+ " vec.close()"
13311342 ]
13321343 },
13331344 {
Original file line number Diff line number Diff line change 1212 'timescale_vector/client.py' ),
1313 'timescale_vector.client.Async._get_approx_count' : ( 'vector.html#async._get_approx_count' ,
1414 'timescale_vector/client.py' ),
15+ 'timescale_vector.client.Async.close' : ('vector.html#async.close' , 'timescale_vector/client.py' ),
1516 'timescale_vector.client.Async.connect' : ( 'vector.html#async.connect' ,
1617 'timescale_vector/client.py' ),
1718 'timescale_vector.client.Async.create_ivfflat_index' : ( 'vector.html#async.create_ivfflat_index' ,
7273 'timescale_vector/client.py' ),
7374 'timescale_vector.client.Sync._translate_to_pyformat' : ( 'vector.html#sync._translate_to_pyformat' ,
7475 'timescale_vector/client.py' ),
76+ 'timescale_vector.client.Sync.close' : ('vector.html#sync.close' , 'timescale_vector/client.py' ),
7577 'timescale_vector.client.Sync.connect' : ('vector.html#sync.connect' , 'timescale_vector/client.py' ),
7678 'timescale_vector.client.Sync.create_ivfflat_index' : ( 'vector.html#sync.create_ivfflat_index' ,
7779 'timescale_vector/client.py' ),
Original file line number Diff line number Diff line change @@ -248,6 +248,10 @@ async def init(conn):
248248
249249 self .pool = await asyncpg .create_pool (dsn = self .service_url , init = init )
250250 return self .pool .acquire ()
251+
252+ async def close (self ):
253+ if self .pool != None :
254+ await self .pool .close ()
251255
252256 async def table_is_empty (self ):
253257 """
@@ -429,6 +433,10 @@ def connect(self):
429433 finally :
430434 self .pool .putconn (connection )
431435
436+ def close (self ):
437+ if self .pool != None :
438+ self .pool .closeall ()
439+
432440 def _translate_to_pyformat (self , query_string , params ):
433441 """
434442 Translates dollar sign number parameters and list parameters to pyformat strings.
You can’t perform that action at this time.
0 commit comments