Skip to content

Comments

[BEAM-2595] Allow table schema objects in BQ DoFn#3556

Closed
sb2nov wants to merge 1 commit intoapache:masterfrom
sb2nov:BEAM-2595-allow-table-schema-bq-dogn
Closed

[BEAM-2595] Allow table schema objects in BQ DoFn#3556
sb2nov wants to merge 1 commit intoapache:masterfrom
sb2nov:BEAM-2595-allow-table-schema-bq-dogn

Conversation

@sb2nov
Copy link
Contributor

@sb2nov sb2nov commented Jul 13, 2017

Be sure to do all of the following to help us incorporate your contribution
quickly and easily:

  • Make sure the PR title is formatted like:
    [BEAM-<Jira issue #>] Description of pull request
  • Make sure tests pass via mvn clean verify.
  • Replace <Jira issue #> in the title with the actual Jira issue
    number, if there is one.
  • If this contribution is large, please file an Apache
    Individual Contributor License Agreement.

R: @chamikaramj PTAL

@sb2nov
Copy link
Contributor Author

sb2nov commented Jul 13, 2017

Retest this please

@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 70.701% when pulling f89d59d on sb2nov:BEAM-2595-allow-table-schema-bq-dogn into 66b4a1b on apache:master.

Copy link
Contributor

@chamikaramj chamikaramj left a comment

Choose a reason for hiding this comment

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

Thanks. Mostly nits.

return table_schema

@staticmethod
def table_schema_to_dict(table_schema):
Copy link
Contributor

Choose a reason for hiding this comment

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

Please expand this doc comment with info on arg and return value.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

return schema

@staticmethod
def get_dict_table_schema(schema):
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -1192,21 +1192,12 @@ def __init__(self, table_id, dataset_id, project_id, batch_size, schema,
@staticmethod
def get_table_schema(schema):
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a doc comment including information about argument and return value.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

elif schema is None:
if schema is None:
return schema
elif isinstance(schema, bigquery.TableSchema):
Copy link
Contributor

Choose a reason for hiding this comment

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

When will we hit this ? Seems like schema will always be a dict now ?

Pls remove if this path is dead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -995,6 +1021,45 @@ def test_simple_schema_parsing(self):
fields=[string_field, number_field])
self.assertEqual(expected_table_schema, table_schema)
Copy link
Contributor

Choose a reason for hiding this comment

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

Pls expand this test to convert this schema to a dict and compare with the original dict. Also include nested fields.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated with nested fields and added an end-2-end test.

@sb2nov sb2nov force-pushed the BEAM-2595-allow-table-schema-bq-dogn branch from f89d59d to 37ca0db Compare July 13, 2017 19:02
Copy link
Contributor Author

@sb2nov sb2nov left a comment

Choose a reason for hiding this comment

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

@chamikaramj PTAL again

@@ -1192,21 +1192,12 @@ def __init__(self, table_id, dataset_id, project_id, batch_size, schema,
@staticmethod
def get_table_schema(schema):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

elif schema is None:
if schema is None:
return schema
elif isinstance(schema, bigquery.TableSchema):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

return table_schema

@staticmethod
def table_schema_to_dict(table_schema):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

return schema

@staticmethod
def get_dict_table_schema(schema):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -995,6 +1021,45 @@ def test_simple_schema_parsing(self):
fields=[string_field, number_field])
self.assertEqual(expected_table_schema, table_schema)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated with nested fields and added an end-2-end test.

@chamikaramj
Copy link
Contributor

LGTM

@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) to 70.698% when pulling 37ca0db on sb2nov:BEAM-2595-allow-table-schema-bq-dogn into 889776f on apache:master.

@asfgit asfgit closed this in e8c5574 Jul 13, 2017
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.

3 participants