mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-10-20 05:15:08 +00:00
Bigquery support for env without passing any config (#2160)
* Bigquery support for env without passing any config * Bigquery File formatted
This commit is contained in:
parent
a784bc217d
commit
6f5a4eafe7
@ -2,9 +2,6 @@
|
|||||||
"source": {
|
"source": {
|
||||||
"type": "bigquery",
|
"type": "bigquery",
|
||||||
"config": {
|
"config": {
|
||||||
"project_id": "project_id",
|
|
||||||
"host_port": "bigquery.googleapis.com",
|
|
||||||
"username": "gcpuser@project_id.iam.gserviceaccount.com",
|
|
||||||
"service_name": "gcp_bigquery",
|
"service_name": "gcp_bigquery",
|
||||||
"options":{
|
"options":{
|
||||||
"credentials":{
|
"credentials":{
|
||||||
|
@ -54,6 +54,8 @@ _types.get_columns = get_columns
|
|||||||
|
|
||||||
class BigQueryConfig(SQLConnectionConfig):
|
class BigQueryConfig(SQLConnectionConfig):
|
||||||
scheme = "bigquery"
|
scheme = "bigquery"
|
||||||
|
host_port: Optional[str] = "bigquery.googleapis.com"
|
||||||
|
username: Optional[str] = None
|
||||||
project_id: Optional[str] = None
|
project_id: Optional[str] = None
|
||||||
duration: int = 1
|
duration: int = 1
|
||||||
service_type = "BigQuery"
|
service_type = "BigQuery"
|
||||||
@ -72,7 +74,11 @@ class BigquerySource(SQLSource):
|
|||||||
def create(cls, config_dict, metadata_config_dict, ctx):
|
def create(cls, config_dict, metadata_config_dict, ctx):
|
||||||
config: SQLConnectionConfig = BigQueryConfig.parse_obj(config_dict)
|
config: SQLConnectionConfig = BigQueryConfig.parse_obj(config_dict)
|
||||||
metadata_config = MetadataServerConfig.parse_obj(metadata_config_dict)
|
metadata_config = MetadataServerConfig.parse_obj(metadata_config_dict)
|
||||||
if config.options.get("credentials", None):
|
if config.options.get("credentials_path"):
|
||||||
|
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = config.options[
|
||||||
|
"credentials_path"
|
||||||
|
]
|
||||||
|
elif config.options.get("credentials", None):
|
||||||
cred_path = create_credential_temp_file(config.options.get("credentials"))
|
cred_path = create_credential_temp_file(config.options.get("credentials"))
|
||||||
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = cred_path
|
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = cred_path
|
||||||
config.options["credentials_path"] = cred_path
|
config.options["credentials_path"] = cred_path
|
||||||
|
Loading…
x
Reference in New Issue
Block a user