[Bug] Fix dataset path check in Table::open (#326)

Fixed a bug that prevents to open remote tables.
This commit is contained in:
Lei Xu
2023-07-18 08:45:10 -07:00
committed by GitHub
parent 3537afb2c3
commit a86bc05131

View File

@@ -534,7 +534,9 @@ class LanceTable(Table):
@classmethod
def open(cls, db, name):
tbl = cls(db, name)
if not os.path.exists(tbl._dataset_uri):
fs, path = pa.fs.FileSystem.from_uri(tbl._dataset_uri)
file_info = fs.get_file_info(path)
if file_info.type != pa.fs.FileType.Directory:
raise FileNotFoundError(
f"Table {name} does not exist. Please first call db.create_table({name}, data)"
)