feat(oauth): adding necessary changes to support bigquery oauth (#30674)

This commit is contained in:
Jack
2024-10-30 14:56:22 -05:00
committed by GitHub
parent bc5da631c8
commit 849d426e06
19 changed files with 191 additions and 48 deletions

View File

@@ -151,12 +151,13 @@ class TestPostgresDbEngineSpec(TestDbEngineSpec):
DB Eng Specs (postgres): Test estimate_statement_cost select star
"""
database = mock.Mock()
cursor = mock.Mock()
cursor.fetchone.return_value = (
"Seq Scan on birth_names (cost=0.00..1537.91 rows=75691 width=46)",
)
sql = "SELECT * FROM birth_names"
results = PostgresEngineSpec.estimate_statement_cost(sql, cursor)
results = PostgresEngineSpec.estimate_statement_cost(database, sql, cursor)
assert results == {"Start-up cost": 0.0, "Total cost": 1537.91}
def test_estimate_statement_invalid_syntax(self):
@@ -165,6 +166,7 @@ class TestPostgresDbEngineSpec(TestDbEngineSpec):
"""
from psycopg2 import errors
database = mock.Mock()
cursor = mock.Mock()
cursor.execute.side_effect = errors.SyntaxError(
"""
@@ -175,7 +177,7 @@ class TestPostgresDbEngineSpec(TestDbEngineSpec):
)
sql = "DROP TABLE birth_names"
with self.assertRaises(errors.SyntaxError):
PostgresEngineSpec.estimate_statement_cost(sql, cursor)
PostgresEngineSpec.estimate_statement_cost(database, sql, cursor)
def test_query_cost_formatter_example_costs(self):
"""