Skip to content

[BUG]Elasticsearch数据源问题 #176

@yinchuan9527

Description

@yinchuan9527

SQLBot Version
v1.1.4

Run Mode
Docker

Describe the bug

  1. 配置ES数据源时,如果有权限,则第一步校验失败
  2. 把用户名、密码拼在url上时第一步通过后,在第二步获取表信息时报错如下
2025-09-22 11:12:03,084 - common.core.response_middleware - ERROR:68 - HTTP Exception: Get table Failed: ('cannot unpack non-iterable NoneType object',)
Traceback (most recent call last):
  File "/opt/sqlbot/app/apps/datasource/api/datasource.py", line 99, in get_tables_by_conf
    return getTablesByDs(session, ds)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/sqlbot/app/apps/datasource/crud/datasource.py", line 135, in getTablesByDs
    tables = get_tables(ds)
             ^^^^^^^^^^^^^^
  File "/opt/sqlbot/app/apps/db/db.py", line 267, in get_tables
    sql, sql_param = get_table_sql(ds, conf, get_version(ds))
    ^^^^^^^^^^^^^^
TypeError: cannot unpack non-iterable NoneType object

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/sqlbot/app/.venv/lib/python3.11/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
    await app(scope, receive, sender)
  File "/opt/sqlbot/app/.venv/lib/python3.11/site-packages/starlette/routing.py", line 73, in app
    response = await f(request)
               ^^^^^^^^^^^^^^^^
  File "/opt/sqlbot/app/.venv/lib/python3.11/site-packages/fastapi/routing.py", line 301, in app
    raw_response = await run_endpoint_function(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/sqlbot/app/.venv/lib/python3.11/site-packages/fastapi/routing.py", line 212, in run_endpoint_function
    return await dependant.call(**values)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/sqlbot/app/apps/datasource/api/datasource.py", line 108, in get_tables_by_conf
    raise HTTPException(status_code=500, detail=f'Get table Failed: {e.args}')

To Reproduce

Expected behavior

Screenshots

Additional context

Metadata

Metadata

Labels

DonebugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions