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

Missing space in VariableFilter where clause construction #1390

Closed
andy-esch opened this issue Dec 18, 2019 · 4 comments
Closed

Missing space in VariableFilter where clause construction #1390

andy-esch opened this issue Dec 18, 2019 · 4 comments

Comments

@andy-esch
Copy link
Contributor

andy-esch commented Dec 18, 2019

where = 'WHERE {}'.format('AND '.join(where_clausules))

If we add a space before the AND it might take care of an error I get when trying to apply two VariableFilters:

[{'reason': 'invalidQuery', 'location': 'query', 'message': 'Syntax error: Missing whitespace between literal and alias at [32:65]'}]

Here's my code:

enriched_data = enrich.enrich_polygons(
    polys,
    variables=dataset_vars,
    filters=[
        VariableFilter(
            Variable.get("date_range_star_d1bbce15"), "= 1567296000 "
        ),
        VariableFilter(dataset_vars[-1], " is not null "),
    ],
    aggregation={dataset_vars[-1].id: "ARRAY_AGG"},
)

If I add spaces around the filter condition in the VariableFilter it works just fine but when I remove the spaces that error shows up.

For example:

# this works
    filters=[
        VariableFilter(
            Variable.get("date_range_star_d1bbce15"), "= 1567296000 "
        ),
        VariableFilter(dataset_vars[-1], " is not null "),
    ],
# this doesn't work
    filters=[
        VariableFilter(
            Variable.get("date_range_star_d1bbce15"), "= 1567296000"
        ),
        VariableFilter(dataset_vars[-1], "is not null"),
    ],
@Jesus89
Copy link
Member

Jesus89 commented Dec 20, 2019

This could be solved with #1397.

cc @oleurud.

@simon-contreras-deel
Copy link
Contributor

🚀 It should be solved. Take into account #1406

@cmongut
Copy link
Contributor

cmongut commented Jan 21, 2020

@andy-esch could you check this issue has been solved?

@Jesus89
Copy link
Member

Jesus89 commented Jun 17, 2020

Already solved

@Jesus89 Jesus89 closed this as completed Jun 17, 2020
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

4 participants