Skip to content

feat(add-db): Add Big Query Form - #14535

Closed
hughhhh wants to merge 19 commits into
masterfrom
hugh/bg-form
Closed

feat(add-db): Add Big Query Form#14535
hughhhh wants to merge 19 commits into
masterfrom
hugh/bg-form

Conversation

@hughhhh

@hughhhh hughhhh commented May 8, 2021

Copy link
Copy Markdown
Member

SUMMARY

Creating a big query form parameters to allow for integration with new db modal flow. Users will have a custom form to setup their big query connections. This is only the backend piece, a follow up ticket will have the frontend handling the custom form.

Also patched the pylint to allow us to have the abstract methods not duplicated in every engine until we implement them

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TEST PLAN

ADDITIONAL INFORMATION

  • Has associated issue:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@codecov

codecov Bot commented May 8, 2021

Copy link
Copy Markdown

Codecov Report

Merging #14535 (3a05e98) into master (4f5c537) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #14535   +/-   ##
=======================================
  Coverage   77.54%   77.54%           
=======================================
  Files         958      958           
  Lines       48541    48541           
  Branches     5702     5702           
=======================================
  Hits        37640    37640           
  Misses      10700    10700           
  Partials      201      201           
Flag Coverage Δ
javascript 72.51% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
superset/db_engine_specs/athena.py 86.95% <100.00%> (ø)
superset/db_engine_specs/base.py 88.45% <100.00%> (ø)
superset/db_engine_specs/bigquery.py 95.87% <100.00%> (ø)
superset/db_engine_specs/cockroachdb.py 100.00% <100.00%> (ø)
superset/db_engine_specs/crate.py 92.30% <100.00%> (ø)
superset/db_engine_specs/databricks.py 100.00% <100.00%> (ø)
superset/db_engine_specs/db2.py 91.66% <100.00%> (ø)
superset/db_engine_specs/dremio.py 90.00% <100.00%> (ø)
superset/db_engine_specs/drill.py 82.75% <100.00%> (ø)
superset/db_engine_specs/firebird.py 100.00% <100.00%> (ø)
... and 19 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4f5c537...3a05e98. Read the comment docs.

@pull-request-size pull-request-size Bot added size/L and removed size/M labels May 10, 2021
@hughhhh
hughhhh marked this pull request as ready for review May 12, 2021 17:48
@betodealmeida
betodealmeida self-requested a review May 17, 2021 16:35
Comment thread superset/db_engine_specs/bigquery.py Outdated
Comment thread superset/db_engine_specs/bigquery.py Outdated
Comment thread superset/db_engine_specs/base.py Outdated
Comment on lines +308 to +315
def build_sqlalchemy_url(cls, parameters: BigQueryParametersType) -> str:
project_id = (
parameters.get("credentials_json", {})
.get("credentials_info", {})
.get("project_id")
)

return f"{cls.drivername}://{project_id}"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

One thing we might consider this is that we would have to pass the credentials info in two different places: secure_extra and parameters. We need to pass it in secure_extra so it's stored encrypted in the database (in the encrypted_extra column). But I think this is fine for now.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also, @eschutho, should we use brackets or triple slashes here? I remember you had problems with this before.

Comment thread superset/db_engine_specs/bigquery.py Outdated

class BigQueryEngineSpec(BaseEngineSpec):
class BigQueryParametersSchema(Schema):
credentials_json = fields.Dict(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we be more specific here, to leverage Marshmallow validation? The credentials looks like this:

{
  "type": "service_account",
  "project_id": "optimal-aurora-285000",
  "private_key_id": "a1a0f6e452b06c145878f283fcb2d252759b97a3",
  "private_key": "-----BEGIN PRIVATE KEY-----\nXXX\n-----END PRIVATE KEY-----\n",
  "client_email": "superset@optimal-aurora-285000.iam.gserviceaccount.com",
  "client_id": "114899578697537931695",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://oauth2.googleapis.com/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/superset%40optimal-aurora-285000.iam.gserviceaccount.com"
}

hughhhh and others added 7 commits May 17, 2021 14:20
Co-authored-by: Beto Dealmeida <roberto@dealmeida.net>
Co-authored-by: Beto Dealmeida <roberto@dealmeida.net>
Co-authored-by: Beto Dealmeida <roberto@dealmeida.net>
@hughhhh

hughhhh commented May 18, 2021

Copy link
Copy Markdown
Member Author

Closing in favor of #14700

@hughhhh hughhhh closed this May 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants