Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"IndexError: no such group" in python driver when using with superset and partitionned tables #45149

Open
renaudk opened this issue May 6, 2024 · 1 comment
Labels
type/bug Something isn't working

Comments

@renaudk
Copy link

renaudk commented May 6, 2024

Steps to reproduce the behavior (Required)

  1. Create a partitionned table with primary key
CREATE TABLE IF NOT EXISTS mydata (
	id BIGINT,
	created_on DATETIME
)
ENGINE=OLAP
PRIMARY KEY(`id`, `created_on`)
PARTITION BY date_trunc('year', `created_on`)
DISTRIBUTED BY HASH(`id`, `created_on`);
  1. Try to add dataset in superset

Expected behavior (Required)

Should work

Real behavior (Required)

Superset show error: An Error Occurred - Unable to load columns for the selected table. Please select a different table.
superset-error

Output:

2024-05-06 16:39:43,982:ERROR:flask_appbuilder.api:no such group
Traceback (most recent call last):
  File "/root/venv/lib/python3.10/site-packages/flask_appbuilder/api/__init__.py", line 110, in wraps
    return f(self, *args, **kwargs)
  File "/root/venv/lib/python3.10/site-packages/superset/views/base_api.py", line 127, in wraps
    raise ex
  File "/root/venv/lib/python3.10/site-packages/superset/views/base_api.py", line 121, in wraps
    duration, response = time_function(f, self, *args, **kwargs)
  File "/root/venv/lib/python3.10/site-packages/superset/utils/core.py", line 1463, in time_function
    response = func(*args, **kwargs)
  File "/root/venv/lib/python3.10/site-packages/superset/utils/log.py", line 255, in wrapper
    value = f(*args, **kwargs)
  File "/root/venv/lib/python3.10/site-packages/superset/databases/api.py", line 742, in table_metadata
    table_info = get_table_metadata(database, table_name, schema_name)
  File "/root/venv/lib/python3.10/site-packages/superset/databases/utils.py", line 67, in get_table_metadata
    columns = database.get_columns(table_name, schema_name)
  File "/root/venv/lib/python3.10/site-packages/superset/models/core.py", line 839, in get_columns
    return self.db_engine_spec.get_columns(
  File "/root/venv/lib/python3.10/site-packages/superset/db_engine_specs/base.py", line 1340, in get_columns
    cast(list[SQLAColumnType], inspector.get_columns(table_name, schema))
  File "/root/venv/lib/python3.10/site-packages/sqlalchemy/engine/reflection.py", line 497, in get_columns
    col_defs = self.dialect.get_columns(
  File "<string>", line 2, in get_columns
  File "/root/venv/lib/python3.10/site-packages/sqlalchemy/engine/reflection.py", line 55, in cache
    ret = fn(self, con, *args, **kw)
  File "/root/venv/lib/python3.10/site-packages/sqlalchemy/dialects/mysql/base.py", line 2835, in get_columns
    parsed_state = self._parsed_state_or_create(
  File "/root/venv/lib/python3.10/site-packages/sqlalchemy/dialects/mysql/base.py", line 3085, in _parsed_state_or_create
    return self._setup_parser(
  File "<string>", line 2, in _setup_parser
  File "/root/venv/lib/python3.10/site-packages/sqlalchemy/engine/reflection.py", line 55, in cache
    ret = fn(self, con, *args, **kw)
  File "/root/venv/lib/python3.10/site-packages/sqlalchemy/dialects/mysql/base.py", line 3121, in _setup_parser
    return parser.parse(sql, charset)
  File "/root/venv/lib/python3.10/site-packages/starrocks/reflection.py", line 58, in parse
    self._parse_table_options(re.split(r"\r?\n", show_create.rsplit(') ')[-1]), state)
  File "/root/venv/lib/python3.10/site-packages/starrocks/reflection.py", line 223, in _parse_table_options
    skip_lines = self._parse_partition_desc(lines, index, state)
  File "/root/venv/lib/python3.10/site-packages/starrocks/reflection.py", line 301, in _parse_partition_desc
    state.table_options["%s_%s" % (self.dialect.name, "partition_by")] = m.group("partition")
IndexError: no such group

StarRocks version (Required)

  • 3.2.6-2585333

Apache Superset version

  • 4.0.0

StarRocks python driver

  • 1.0.6
@renaudk renaudk added the type/bug Something isn't working label May 6, 2024
@renaudk
Copy link
Author

renaudk commented May 6, 2024

As a workaround, I tried to comment line 300 & 301 of starrocks/reflection.py and the error has gone.
Is there any risk of side effect?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant