Skip to content

Commit a1c60ee

Browse files
committed
fix flake8 errors from latest PRs
1 parent 26dffb4 commit a1c60ee

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

pybigquery/sqlalchemy_bigquery.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,10 +426,20 @@ def _table_reference(self, provided_schema_name, provided_table_name,
426426
raise ValueError("Did not understand schema: {}".format(provided_schema_name))
427427
if (dataset_id_from_schema and dataset_id_from_table and
428428
dataset_id_from_schema != dataset_id_from_table):
429-
raise ValueError("dataset_id specified in schema and table_name disagree: got {} in schema, and {} in table_name".format(dataset_id_from_schema, dataset_id_from_table))
429+
raise ValueError(
430+
"dataset_id specified in schema and table_name disagree: "
431+
"got {} in schema, and {} in table_name".format(
432+
dataset_id_from_schema, dataset_id_from_table
433+
)
434+
)
430435
if (project_id_from_schema and project_id_from_table and
431436
project_id_from_schema != project_id_from_table):
432-
raise ValueError("project_id specified in schema and table_name disagree: got {} in schema, and {} in table_name".format(project_id_from_schema, project_id_from_table))
437+
raise ValueError(
438+
"project_id specified in schema and table_name disagree: "
439+
"got {} in schema, and {} in table_name".format(
440+
project_id_from_schema, project_id_from_table
441+
)
442+
)
433443
project_id = project_id_from_schema or project_id_from_table or client_project
434444
dataset_id = dataset_id_from_schema or dataset_id_from_table or self.dataset_id
435445

test/test_sqlalchemy_bigquery.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,8 @@ def test_nested_labels(engine, table):
314314
col = table.c.integer
315315
exprs = [
316316
sqlalchemy.func.sum(
317-
sqlalchemy.func.sum(col.label("inner")
318-
).label("outer")).over(),
317+
sqlalchemy.func.sum(col.label("inner")).label("outer")
318+
).over(),
319319
sqlalchemy.func.sum(
320320
sqlalchemy.case([[
321321
sqlalchemy.literal(True),
@@ -346,7 +346,10 @@ def test_session_query(session, table, session_using_test_dataset, table_using_t
346346
table.c.string,
347347
col_concat,
348348
func.avg(table.c.integer),
349-
func.sum(case([(table.c.boolean is True, 1)], else_=0))
349+
func.sum(case(
350+
[(table.c.boolean == sqlalchemy.literal(True), 1)],
351+
else_=0
352+
))
350353
)
351354
.group_by(table.c.string, col_concat)
352355
.having(func.avg(table.c.integer) > 10)
@@ -557,6 +560,7 @@ def test_table_reference(dialect, provided_schema_name,
557560
assert ref.dataset_id == 'dataset'
558561
assert ref.project == 'project'
559562

563+
560564
@pytest.mark.parametrize('provided_schema_name,provided_table_name,client_project',
561565
[
562566
('project.dataset', 'other_dataset.table', 'project'),

0 commit comments

Comments
 (0)