Skip to content

Commit

Permalink
fix format
Browse files Browse the repository at this point in the history
  • Loading branch information
goldmedal committed Jan 7, 2025
1 parent db091dc commit 65559b2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion ibis-server/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def custom_http_error_handler(request, exc: CustomHttpError):
logger.opt(exception=exc).error("Request failed")
return PlainTextResponse(str(exc), status_code=exc.status_code)


@app.exception_handler(NotImplementedError)
def not_implemented_error_handler(request, exc: NotImplementedError):
return PlainTextResponse(str(exc), status_code=501)
return PlainTextResponse(str(exc), status_code=501)
4 changes: 3 additions & 1 deletion ibis-server/app/model/data_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ def get_connection(self, info: ConnectionInfo) -> BaseBackend:
if hasattr(info, "connection_url"):
return ibis.connect(info.connection_url.get_secret_value())
if self.name == "local_file":
raise NotImplementedError("Local file connection is not implemented to get ibis backend")
raise NotImplementedError(
"Local file connection is not implemented to get ibis backend"
)
return getattr(self, f"get_{self.name}_connection")(info)
except KeyError:
raise NotImplementedError(f"Unsupported data source: {self}")
Expand Down
5 changes: 3 additions & 2 deletions ibis-server/app/model/metadata/object_storage.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os

import duckdb
import opendal
import os

from app.model import LocalFileConnectionInfo
from app.model.metadata.dto import (
Expand Down Expand Up @@ -28,7 +29,7 @@ def get_table_list(self) -> list[Table]:
table_name = os.path.basename(os.path.normpath(file.path))
else:
# if the file is a file, use the file name as the table name
table_name = table_name = os.path.splitext(os.path.basename(file.path))[0]
table_name = os.path.splitext(os.path.basename(file.path))[0]
unique_tables[table_name] = Table(
name=table_name,
description=None,
Expand Down
1 change: 1 addition & 0 deletions ibis-server/tests/routers/v2/connector/test_local_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ async def test_metadata_db_version(client, connection_info):
assert response.status_code == 200
assert "Local File System" in response.text


async def test_unsupported_format(client):
response = await client.post(
url=f"{base_url}/metadata/tables",
Expand Down

0 comments on commit 65559b2

Please sign in to comment.