-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Jobs: load from storage #1056
Jobs: load from storage #1056
Conversation
Does this have a diffbase? |
Nope -- I rebased it before pushing. Too big? |
I just wasn't sure since there were 8 commits. Also, you're failing pep8 (that one runs fast, pylint is the slow one). |
Also ISTM a rebase won't feel very good due to the merging of #1051. |
I will fix it up (both the pep8 and the date stuff) and re-push. |
Thanks. Ping me when you push. |
Ugh! The pep8 fix was trivial, but working around the pylint 'too-many-branches' failures made me grind my teeth (4c14890) |
This thing is all ready to review? |
Hold off a bit -- I'm adding a system test for the "load from cloud storage" case, and it is failing. |
@dhermes OK, got the system test added and passing. |
@@ -96,3 +97,20 @@ def dataset(self, name): | |||
:returns: a new ``Dataset`` instance | |||
""" | |||
return Dataset(name, client=self) | |||
|
|||
def load_from_storage(self, name, destination, *source_uris): |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Models job request to load a BQ table from file(s) in CloudStorage.
Builds an instance of 'job.LoadFromStorageJob'.
- 'table.Table._parse_schema_resource' -> 'table._parse_schema_resource' - 'table.Table._build_schema_resource' -> 'table._build_schema_resource'
Found while attempting to add a system test for the 'load from storage' case.
Users who want to avoid tripping over string literal mismatches can use class constants instead. Addresses: https://github.com/GoogleCloudPlatform/gcloud-python/pull/1056/files#r37029533
- 'Client.load_from_storage' -> 'Client.load_table_from_storage'. - 'job.LoadFromStorageJob' -> 'job.LoadTableFromStorageJob'. Addresses: https://github.com/GoogleCloudPlatform/gcloud-python/pull/1056/files#r37120652
I didn't want to eat the extra dependency. We have #1031 to track the idea, though. |
Why not? It's lightweight and hopefully most users already have it >>> import enum
>>>
>>> class RedBlue(enum.Enum):
... RED = 'RED'
... BLUE = 'BLUE'
...
>>>
>>> to_validate = 'RED'
>>> rb = RedBlue(to_validate)
>>> print(rb)
RedBlue.RED
>>> print(rb.value)
RED
>>>
>>> to_validate = 'GREEN'
>>> try:
... RedBlue(to_validate)
... except ValueError as exc:
... print(repr(exc))
... print('%s was not validated' % (to_validate,))
...
ValueError('GREEN is not a valid RedBlue',)
GREEN was not validated |
Most users are on Python2, and likely won't have it unless some other library has pushed them to add it. Again, we can clean up here (and in the other APIs) when we address #1031. |
LGTM. I really hope the follow-up commits can spread out some of the pain here. I was saying that most Python 2 only users would have lots of libraries installed that straddled Py2 and Py3, and hence would have a good chance that one of them used |
@tseaver Please ping me on anything that will get rebased after this goes in. |
Add support for jobs loading table data from CloudStorage files.