We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
__fspath__
SimpleSQLite
1 parent 5439b5d commit a939488Copy full SHA for a939488
1 file changed
simplesqlite/core.py
@@ -198,6 +198,15 @@ def __enter__(self): # type: ignore
198
def __exit__(self, exc_type, exc_value, traceback) -> None: # type: ignore
199
self.close()
200
201
+ def __fspath__(self) -> str:
202
+ if not self.database_path:
203
+ raise ValueError("database is not connected")
204
+
205
+ if self.database_path == MEMORY_DB_NAME:
206
+ raise ValueError("database is in-memory")
207
208
+ return self.database_path
209
210
def is_connected(self) -> bool:
211
"""
212
:return: |True| if the connection to a database is valid.
0 commit comments