Skip to content

Commit

Permalink
Rename parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
betodealmeida committed Jul 7, 2021
1 parent 2b4f6ee commit 17c7ab5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions superset/db_engine_specs/gsheets.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
class GSheetsParametersType(TypedDict):
credentials_info: Dict[str, Any]
query: Dict[str, Any]
catalog: Dict[str, str]
table_catalog: Dict[str, str]


class GSheetsEngineSpec(SqliteEngineSpec):
Expand Down Expand Up @@ -94,9 +94,9 @@ def validate_parameters(
errors: List[SupersetError] = []

credentials_info = parameters.get("credentials_info")
catalog = parameters.get("catalog", {})
table_catalog = parameters.get("table_catalog", {})

if not catalog:
if not table_catalog:
return errors

# We need a subject in case domain wide delegation is set, otherwise the
Expand All @@ -109,7 +109,7 @@ def validate_parameters(
"gsheets://", service_account_info=credentials_info, subject=subject,
)
conn = engine.connect()
for name, url in catalog.items():
for name, url in table_catalog.items():
try:
results = conn.execute(f'SELECT * FROM "{url}" LIMIT 1')
results.fetchall()
Expand Down
4 changes: 2 additions & 2 deletions tests/unit_tests/db_engine_specs/test_gsheets.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_validate_parameters_catalog(mocker, app_context):
]

parameters = {
"catalog": {
"table_catalog": {
"private_sheet": "https://docs.google.com/spreadsheets/d/1/edit",
"public_sheet": "https://docs.google.com/spreadsheets/d/1/edit#gid=1",
"not_a_sheet": "https://www.google.com/",
Expand Down Expand Up @@ -134,7 +134,7 @@ def test_validate_parameters_catalog_and_credentials(mocker, app_context):
]

parameters = {
"catalog": {
"table_catalog": {
"private_sheet": "https://docs.google.com/spreadsheets/d/1/edit",
"public_sheet": "https://docs.google.com/spreadsheets/d/1/edit#gid=1",
"not_a_sheet": "https://www.google.com/",
Expand Down

0 comments on commit 17c7ab5

Please sign in to comment.