Skip to content

ValueError: could not assign tuple of length 4 to structure with 3 fields. #6

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

Closed
nalcabio-tom opened this issue Feb 25, 2025 · 5 comments

Comments

@nalcabio-tom
Copy link

Adding p_timestamp as a filter in the superset dashboard causes the error below. Using ctx#timestamp instead doesn't cause an error, although that might be because no data is returned since the start and end times restrict the query to the last 10 minutes. (Last time data was added to parseable was yesterday, fyi.)

025-02-25 17:38:07,714:WARNING:superset.connectors.sqla.models:Query SELECT "ctx#timestamp" AS "ctx#timestamp", "ctx#event" AS "ctx#event", "data#device-state" AS "data#device-state", p_timestamp AS p_timestamp
FROM nalca1
WHERE p_timestamp >= '2025-02-24 00:00:00.000000' AND p_timestamp < '2025-03-03 00:00:00.000000'
 LIMIT 100 on schema default failed
Traceback (most recent call last):
  File "/app/superset/connectors/sqla/models.py", line 1761, in query
    df = self.database.get_df(
  File "/app/superset/models/core.py", line 684, in get_df
    result_set = SupersetResultSet(
  File "/app/superset/result_set.py", line 135, in __init__
    array = np.array(data, dtype=numpy_dtype)
ValueError: could not assign tuple of length 4 to structure with 3 fields.

See also: #5

@AdheipSingh
Copy link
Collaborator

Hi @nalcabio-tom , thanks for bringing up this issue.
Is it possible for you to sure the exact log ? if you are running superset you should see logs such that original query in superset vs modified query for parseable. It will help me understand better.

Though i get your issue, basically query is returning 4 columns and structure expected to receive data is 3 columns.
When you execute a query and get results back, the current column structure is being created based on the first row's keys here.

I'll try to re-create this issue and get back to you.

@nalcabio-tom
Copy link
Author

Hi @AdheipSingh . Sorry, I don't understand your question. The query above does work in the parseable dashboard.

@nalcabio-tom
Copy link
Author

@AdheipSingh , is there anything I can do to help with this? Thanks!

@AdheipSingh
Copy link
Collaborator

Hi @nalcabio-tom , can you try out with the latest updated package ie 0.1.5. I tried with a similar query in my dataset.

Image

@nalcabio-tom
Copy link
Author

Thanks @AdheipSingh ! This appears to work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants