mirror of
https://github.com/lancedb/lancedb.git
synced 2025-12-23 13:29:57 +00:00
Compare commits
2 Commits
python-v0.
...
aidangomar
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2acd9d0f0e | ||
|
|
49b6e77e4b |
@@ -22,6 +22,8 @@ from .remote.db import RemoteDBConnection
|
|||||||
from .schema import vector # noqa: F401
|
from .schema import vector # noqa: F401
|
||||||
from .utils import sentry_log # noqa: F401
|
from .utils import sentry_log # noqa: F401
|
||||||
|
|
||||||
|
import requests
|
||||||
|
|
||||||
|
|
||||||
def connect(
|
def connect(
|
||||||
uri: URI,
|
uri: URI,
|
||||||
@@ -70,3 +72,26 @@ def connect(
|
|||||||
raise ValueError(f"api_key is required to connected LanceDB cloud: {uri}")
|
raise ValueError(f"api_key is required to connected LanceDB cloud: {uri}")
|
||||||
return RemoteDBConnection(uri, api_key, region, host_override)
|
return RemoteDBConnection(uri, api_key, region, host_override)
|
||||||
return LanceDBConnection(uri)
|
return LanceDBConnection(uri)
|
||||||
|
|
||||||
|
def drop_database(uri: URI, api_key: str, region: str = "us-west-2"):
|
||||||
|
"""Drop a LanceDB database.
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
uri: str or Path
|
||||||
|
The uri of the database.
|
||||||
|
|
||||||
|
Examples
|
||||||
|
--------
|
||||||
|
|
||||||
|
>>> lancedb.drop_database(uri="db://", api_key="sk_...", region="...")
|
||||||
|
|
||||||
|
"""
|
||||||
|
if isinstance(uri, str) and uri.startswith("db://"):
|
||||||
|
control_plane_url = f"control-plane.{region}.api.lancedb.com"
|
||||||
|
requests.delete(
|
||||||
|
f"https://{control_plane_url}/api/v1/auth/token/delete",
|
||||||
|
json={"api_key": api_key}
|
||||||
|
)
|
||||||
|
return LanceDBConnection(uri).drop_database()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user