Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Wrapping up a few Managing Table samples #7

Merged
tswast merged 9 commits intotswast:bq-snippetsfrom
lbristol88:table-snippets
Apr 10, 2019
Merged

Wrapping up a few Managing Table samples #7
tswast merged 9 commits intotswast:bq-snippetsfrom
lbristol88:table-snippets

Conversation

@lbristol88
Copy link

@lbristol88 lbristol88 changed the title Added collection of Managing Table samples Wrapping up a few Managing Table samples Apr 9, 2019
Copy link
Owner

@tswast tswast left a comment

Choose a reason for hiding this comment

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

Looking good! A few updates needed on the tests.

# TODO(developer): Set table_id to the ID of the table to fetch.
# table_id = 'your-project.your_dataset.your_table'

client.delete_table(table_id, not_found_ok=True)
Copy link
Owner

Choose a reason for hiding this comment

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

Let's add a comment about what happens if the table is not found by default. (Raises google.api_core.exceptions.NotFound unless not_found_ok is True.)

Copy link
Author

Choose a reason for hiding this comment

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

Added comment about raising exception.



def test_create_table(capsys, client, random_table_id):
Copy link
Owner

Choose a reason for hiding this comment

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

Looks like we need to copy the test_create_table test to a test_create_table.py file so that we don't lose it.

Copy link
Author

Choose a reason for hiding this comment

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

Opps, accidentally deleted this file. Adding it back now!

list_tables.list_tables(client, dataset_id)
out, err = capsys.readouterr()
assert "Tables contained in '{}':".format(dataset_id) in out
assert "{}".format(table_id) in out
Copy link
Owner

Choose a reason for hiding this comment

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

Since table_id is already a string, no need for "{}".format(. This can be assert table_id in out.

Copy link
Author

Choose a reason for hiding this comment

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

Updated!

Copy link
Owner

@tswast tswast left a comment

Choose a reason for hiding this comment

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

Looks great, thanks!

@tswast tswast merged commit 6b48967 into tswast:bq-snippets Apr 10, 2019
tswast pushed a commit that referenced this pull request Apr 10, 2019
* Updated list tables snippet along with test.

* Removed old list table snippet and upated location of sample
tswast pushed a commit that referenced this pull request Apr 10, 2019
* Updated list tables snippet along with test.

* Removed old list table snippet and upated location of sample
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.

2 participants