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

Review subscription messages #1391

Merged
merged 15 commits into from
Dec 19, 2019
Merged

Conversation

Jesus89
Copy link
Member

@Jesus89 Jesus89 commented Dec 18, 2019

Closes #1155, #1331.

  • Add check_do_enabled: Catalog().subscriptions(), dataset/geography.subscription_info(), dataset/geography.subscribe(), dataset/geography.download(), dataset/geography.get_all(credentials=creds), Enrichment()
  • Add DO disabled message
  • Change subscription message based on estimated_delivery_days
  • Remove duplicated checks
  • Add unit tests

@@ -110,9 +107,6 @@ def _get_print_id(self):
return self.id

def _download(self, file_path, credentials):
if not self._is_available_in('bq'):
Copy link
Contributor

Choose a reason for hiding this comment

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

You can have access to DO, but the Dataset or Geography not been ready in BigQuery. How are we checking that?

Copy link
Member Author

Choose a reason for hiding this comment

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

This comes from #1331 (comment). We are checking this with the do/subscriptions call after the download. However, I'll check this in the acceptance test.

Copy link
Member Author

Choose a reason for hiding this comment

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

@arredond @andy-esch do you think we should keep this check? For the situation when a dataset is "not ready"?

Copy link
Contributor

Choose a reason for hiding this comment

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

About the comment about the duplicated check, we were checking if the dataset/geo has a price which is done by the backend too.

bq_client.download_to_file(job, file_path, column_names=column_names)
except NotFound:
raise CartoException('You have not purchased the dataset `{}` yet'.format(self.id))
bq_client.download_to_file(job, file_path, column_names=column_names)
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here,

You can have access to DO, but not to a Dataset or Geography. How are we checking that?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is checked also in the do/subscriptions call, after the download.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, you are right. Since we are checking if the user is subscribed, ideally we can avoid the try-except. In any case, I will keep it as I tell you offline (but this is opinionable)

@Jesus89
Copy link
Member Author

Jesus89 commented Dec 19, 2019

This requires CartoDB/carto-python#159 to be merged.

I have tested manually the features and all the changes work OK 🍏

About this: #1391 (comment). do we keep the "is available in bq" check in the client? cc @cmongut @arredond @andy-esch

@simon-contreras-deel
Copy link
Contributor

About this: #1391 (comment). do we keep the "is available in bq" check in the client? cc @cmongut @arredond @andy-esch

Yes, we need it

@Jesus89
Copy link
Member Author

Jesus89 commented Dec 19, 2019

OK, changes done.

@Jesus89 Jesus89 force-pushed the 1155-review-subscription-messages branch from a5a798b to 706a771 Compare December 19, 2019 14:58
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.

LGTM

@Jesus89 Jesus89 merged commit 9dd6688 into develop Dec 19, 2019
@Jesus89 Jesus89 deleted the 1155-review-subscription-messages branch December 19, 2019 15:39
@arredond
Copy link
Contributor

Actually, I'm not fully convinced we need that check @oleurud. I understand these checks were in place to satisfy a certain condition:

A user might suscribe to a dataset in a valid way, but that dataset is hosted in BigTable/Spanner/some other place and not in BigQuery, so it can't be used for enrichment or download in CartoFrames.

After what we talked in "Data Observatory next steps" meeting last Tuesday, it seems that BigQuery is going to be the single source of truth for all datasets, so any dataset must be imported first into BQ and then copied to other services. That means that the above case would never happen.

In any case, if we were going to keep performing this check (which I don't think is wrong, just maybe unnecessary), it should be performed via the future API and not validating the client's local metadata, which could be modified by the own client.

Does this make sense @alasarr ?

@simon-contreras-deel
Copy link
Contributor

Then it could be interesting to know if the lib should check it thinking in future versions of CARTOframes (if it is not needed, we could want to remove available_in from the catalog and we would break previous versions).

  • Is it possible having datasets in the catalog and not in BigQuery? being more strict, datasets than can be bought by a user and the data is not in BQ yet?
  • Datasets only for visualizing?

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.

Review subscription workflow messages
3 participants