File tree Expand file tree Collapse file tree 3 files changed +23
-2
lines changed Expand file tree Collapse file tree 3 files changed +23
-2
lines changed Original file line number Diff line number Diff line change 383
383
" \n " ,
384
384
" self.pool = await asyncpg.create_pool(dsn=self.service_url, init=init)\n " ,
385
385
" 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 " ,
386
390
" \n " ,
387
391
" async def table_is_empty(self):\n " ,
388
392
" \"\"\"\n " ,
783
787
" await vec.delete_all()\n " ,
784
788
" assert await vec.table_is_empty()\n " ,
785
789
" \n " ,
786
- " await vec.drop_table()"
790
+ " await vec.drop_table()\n " ,
791
+ " await vec.close()"
787
792
]
788
793
},
789
794
{
848
853
" finally: \n " ,
849
854
" self.pool.putconn(connection)\n " ,
850
855
" \n " ,
856
+ " def close(self):\n " ,
857
+ " if self.pool != None:\n " ,
858
+ " self.pool.closeall()\n " ,
859
+ " \n " ,
851
860
" def _translate_to_pyformat(self, query_string, params):\n " ,
852
861
" \"\"\"\n " ,
853
862
" Translates dollar sign number parameters and list parameters to pyformat strings.\n " ,
1327
1336
" vec.delete_all()\n " ,
1328
1337
" assert vec.table_is_empty()\n " ,
1329
1338
" \n " ,
1330
- " vec.drop_table()"
1339
+ " vec.drop_table()\n " ,
1340
+ " \n " ,
1341
+ " vec.close()"
1331
1342
]
1332
1343
},
1333
1344
{
Original file line number Diff line number Diff line change 12
12
'timescale_vector/client.py' ),
13
13
'timescale_vector.client.Async._get_approx_count' : ( 'vector.html#async._get_approx_count' ,
14
14
'timescale_vector/client.py' ),
15
+ 'timescale_vector.client.Async.close' : ('vector.html#async.close' , 'timescale_vector/client.py' ),
15
16
'timescale_vector.client.Async.connect' : ( 'vector.html#async.connect' ,
16
17
'timescale_vector/client.py' ),
17
18
'timescale_vector.client.Async.create_ivfflat_index' : ( 'vector.html#async.create_ivfflat_index' ,
72
73
'timescale_vector/client.py' ),
73
74
'timescale_vector.client.Sync._translate_to_pyformat' : ( 'vector.html#sync._translate_to_pyformat' ,
74
75
'timescale_vector/client.py' ),
76
+ 'timescale_vector.client.Sync.close' : ('vector.html#sync.close' , 'timescale_vector/client.py' ),
75
77
'timescale_vector.client.Sync.connect' : ('vector.html#sync.connect' , 'timescale_vector/client.py' ),
76
78
'timescale_vector.client.Sync.create_ivfflat_index' : ( 'vector.html#sync.create_ivfflat_index' ,
77
79
'timescale_vector/client.py' ),
Original file line number Diff line number Diff line change @@ -248,6 +248,10 @@ async def init(conn):
248
248
249
249
self .pool = await asyncpg .create_pool (dsn = self .service_url , init = init )
250
250
return self .pool .acquire ()
251
+
252
+ async def close (self ):
253
+ if self .pool != None :
254
+ await self .pool .close ()
251
255
252
256
async def table_is_empty (self ):
253
257
"""
@@ -429,6 +433,10 @@ def connect(self):
429
433
finally :
430
434
self .pool .putconn (connection )
431
435
436
+ def close (self ):
437
+ if self .pool != None :
438
+ self .pool .closeall ()
439
+
432
440
def _translate_to_pyformat (self , query_string , params ):
433
441
"""
434
442
Translates dollar sign number parameters and list parameters to pyformat strings.
You can’t perform that action at this time.
0 commit comments