@@ -39,6 +39,8 @@ def __init__(self) -> None:
39
39
self ._description : list [tuple ] | None = None
40
40
self ._state : CursorStatus = CursorStatus .ready
41
41
42
+ self ._table_path_prefix : str = ""
43
+
42
44
@property
43
45
def description (self ) -> list [tuple ] | None :
44
46
return self ._description
@@ -134,6 +136,12 @@ def _fetchall_from_buffer(self) -> list:
134
136
self ._raise_if_closed ()
135
137
return list (self ._rows or iter ([]))
136
138
139
+ def _append_table_path_prefix (self , query : str ) -> str :
140
+ if self ._table_path_prefix :
141
+ prgm = f'PRAGMA TablePathPrefix = "{ self ._table_path_prefix } ";\n '
142
+ return prgm + query
143
+ return query
144
+
137
145
138
146
class Cursor (BufferedCursor ):
139
147
def __init__ (
@@ -225,6 +233,9 @@ def execute(
225
233
) -> None :
226
234
self ._raise_if_closed ()
227
235
self ._raise_if_running ()
236
+
237
+ query = self ._append_table_path_prefix (query )
238
+
228
239
if self ._tx_context is not None :
229
240
self ._stream = self ._execute_transactional_query (
230
241
tx_context = self ._tx_context , query = query , parameters = parameters
@@ -376,6 +387,9 @@ async def execute(
376
387
) -> None :
377
388
self ._raise_if_closed ()
378
389
self ._raise_if_running ()
390
+
391
+ query = self ._append_table_path_prefix (query )
392
+
379
393
if self ._tx_context is not None :
380
394
self ._stream = await self ._execute_transactional_query (
381
395
tx_context = self ._tx_context , query = query , parameters = parameters
0 commit comments