[Python] Support drop table (#123)

Closes #86
This commit is contained in:
Lei Xu
2023-06-01 15:58:45 -07:00
committed by GitHub
parent 0719e4b3fb
commit 9965b4564d
2 changed files with 36 additions and 0 deletions

View File

@@ -14,6 +14,7 @@
from __future__ import annotations
from pathlib import Path
import os
import pyarrow as pa
@@ -112,3 +113,15 @@ class LanceDBConnection:
A LanceTable object representing the table.
"""
return LanceTable(self, name)
def drop_table(self, name: str):
"""Drop a table from the database.
Parameters
----------
name: str
The name of the table.
"""
filesystem, path = pa.fs.FileSystem.from_uri(self.uri)
table_path = os.path.join(path, name + ".lance")
filesystem.delete_dir(table_path)