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

methods to create and parse standard resource prefixes with repo_name, directory_path as parameters #10

Closed
tswast opened this issue Apr 6, 2021 · 2 comments · Fixed by #39
Labels
type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@tswast
Copy link
Contributor

tswast commented Apr 6, 2021

As discussed in Yoshi Python Chat and googleapis/python-bigquery#590 (comment)

It'd be good to have some utilities for constructing prefixes for resources based on the repo name and directory name, relative to repo root. This would include a timestamp (so that resources without a created time property could be aged) as well as a random identifier.

Likewise, we could have helpers to parse resource identifiers and determine (1) they match the repo name and directory name and (2) they are older than some time-to-live (24 hours seems a good default)

@tswast tswast added the type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. label Apr 6, 2021
@tswast tswast changed the title method to create standard resource prefixes with repo_name, directory_path as parameters methods to create and parse standard resource prefixes with repo_name, directory_path as parameters Apr 6, 2021
@tswast
Copy link
Contributor Author

tswast commented Apr 27, 2021

I actually realized my first implementation has a problem, which I believe I've fixed in googleapis/python-bigquery#627

Turns out that DatasetListItem objects don't actually have a created property (even though Dataset does), so it is more efficient to parse the date from the resource name.

On second glance at this, I'd probably remove the _ from the date format`.

@tswast
Copy link
Contributor Author

tswast commented Jul 1, 2021

Started prototyping here: https://github.com/googleapis/python-test-utils/tree/issue10-resource-prefixes

I don't think we'll want a whole bunch of extra arguments to resource_prefix() and the other functions. I think we'll want some kind of config. Maybe it's actually part of a class? That might actually be an appropriate use for one (holding the RESOURCE_PREFIX constant)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant