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

Support several variables #1056

Merged
merged 9 commits into from
Oct 8, 2019

Conversation

alejandrohall
Copy link
Contributor

No description provided.

@alejandrohall
Copy link
Contributor Author

alejandrohall commented Oct 3, 2019

I have to fix tests!

Copy link
Contributor

@simon-contreras-deel simon-contreras-deel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only some details to be tackled or not, as you wish.

But what we need to add are tests to ensure the final queries with only one table and variable, only a table and several variables, and several tables and several variables. And putting the green light in tests.


for variable in variables:
variable_split = variable.split('.')
table, variable = variable_split[-2], variable_split[-1]
project_part, dataset_part, table_part, variable_part = variable_split
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would use project, dataset, table, variable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, better naming!

@@ -22,9 +24,9 @@ def enrich(query_function, **kwargs):
data_copy = _prepare_data(kwargs['data'], kwargs['data_geom_column'])
tablename = _upload_dataframe(bq_client, user_dataset, data_copy, kwargs['data_geom_column'])

query = _enrichment_query(user_dataset, tablename, query_function, **kwargs)
queries = _enrichment_query(user_dataset, tablename, query_function, **kwargs)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rename method to: _enrichment_queries

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right!

@alejandrohall
Copy link
Contributor Author

alejandrohall commented Oct 7, 2019

@oleurud Tests fixed, they are failing because of another E2E test.

query_function = _prepare_sql_by_points
variables = pd.DataFrame([['table1.var1'], ['table1.var2']], columns=['id'])
variables = pd.DataFrame([['project.dataset.category_table1_comp_geog_geogyear_yearly_datayear.var1'],
Copy link
Contributor

@alrocar alrocar Oct 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see we are modifying the previous tests, but as @oleurud suggested we should have tests for both cases:

  • One for multiple variables from one dataset
  • Another one for multiple variables from several datasets

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we should. Based on this one, you can add both cases easily

for query in queries]

self.assertEqual(sorted(queries), sorted(expected_queries))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line contains whitespace

@Jesus89
Copy link
Member

Jesus89 commented Oct 8, 2019

Can we merge this one?

@alrocar
Copy link
Contributor

alrocar commented Oct 8, 2019

@Jesus89 Wait, while doing acceptance I've found out the notebook is not up to date.

@alejandrohall could you sync with develop and make it work?

Thanks!

@alrocar
Copy link
Contributor

alrocar commented Oct 8, 2019

Acceptance 🍏

@alrocar alrocar merged commit f1a53aa into develop Oct 8, 2019
@alrocar alrocar deleted the feature/support_enriching_several_variables branch October 8, 2019 17:06
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

Successfully merging this pull request may close these issues.

5 participants