Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
changhiskhan committed Dec 20, 2023
1 parent 2d4d0d0 commit a1fc4bd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
7 changes: 3 additions & 4 deletions python/lancedb/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,14 +288,13 @@ def table_names(
A list of table names.
"""
try:
filesystem, path = fs_from_uri(self.uri)
filesystem = fs_from_uri(self.uri)[0]
except pa.ArrowInvalid:
raise NotImplementedError("Unsupported scheme: " + self.uri)

try:
paths = filesystem.get_file_info(
fs.FileSelector(get_uri_location(self.uri))
)
loc = get_uri_location(self.uri)
paths = filesystem.get_file_info(fs.FileSelector(loc))
except FileNotFoundError:
# It is ok if the file does not exist since it will be created
paths = []
Expand Down
11 changes: 6 additions & 5 deletions python/lancedb/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,15 @@ def get_uri_location(uri: str) -> str:
str: Location part of the URL, without scheme
"""
parsed = urlparse(uri)
if len(parsed.scheme) == 1:
# Windows drive names are parsed as the scheme
# e.g. "c:\path" -> ParseResult(scheme="c", netloc="", path="/path", ...)
# So we add special handling here for schemes that are a single character
return uri

if not parsed.netloc:
return parsed.path
else:
if len(parsed.scheme) == 1:
# Windows drive names are parsed as the scheme
# e.g. "c:\path" -> ParseResult(scheme="c", netloc="", path="/path", ...)
# So we add special handling here for schemes that are a single character
return uri
return parsed.netloc + parsed.path


Expand Down

0 comments on commit a1fc4bd

Please sign in to comment.