Fix: Revert Athena tests and types change (#8909)

This commit is contained in:
Milan Bariya 2022-11-21 17:05:23 +05:30 committed by GitHub
parent effba5e170
commit 27997b2f77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 11 deletions

View File

@ -476,9 +476,7 @@ def _(connection: AthenaConnection):
url += ":"
url += f"@athena.{connection.awsConfig.awsRegion}.amazonaws.com:443"
staging_url = connection.s3StagingDir.scheme + "://" + str(connection.s3StagingDir)
url += f"?s3_staging_dir={quote_plus(staging_url)}"
url += f"?s3_staging_dir={quote_plus(connection.s3StagingDir)}"
if connection.workgroup:
url += f"&work_group={connection.workgroup}"
if connection.awsConfig.awsSessionToken:

View File

@ -11,8 +11,6 @@
from unittest import TestCase
from pydantic import AnyUrl
from metadata.generated.schema.entity.services.connections.database.athenaConnection import (
AthenaConnection,
AthenaScheme,
@ -768,20 +766,20 @@ class SouceConnectionTest(TestCase):
awsAccessKeyId="key", awsRegion="us-east-2", awsSecretAccessKey="secret_key"
)
expected_url = "awsathena+rest://key:secret_key@athena.us-east-2.amazonaws.com:443?s3_staging_dir=s3%3A%2F%2Fs3athena-postgres&work_group=primary"
expected_url = "awsathena+rest://key:secret_key@athena.us-east-2.amazonaws.com:443?s3_staging_dir=s3%3A%2F%2Fpostgres%2Finput%2F&work_group=primary"
athena_conn_obj = AthenaConnection(
awsConfig=awsCreds,
s3StagingDir=AnyUrl("s3athena-postgres", scheme="s3"),
s3StagingDir="s3://postgres/input/",
workgroup="primary",
scheme=AthenaScheme.awsathena_rest,
)
assert expected_url == get_connection_url(athena_conn_obj)
# connection arguments with db
expected_url = "awsathena+rest://key:secret_key@athena.us-east-2.amazonaws.com:443?s3_staging_dir=s3%3A%2F%2Fs3athena-postgres&work_group=primary"
# connection arguments witho db
expected_url = "awsathena+rest://key:secret_key@athena.us-east-2.amazonaws.com:443?s3_staging_dir=s3%3A%2F%2Fpostgres%2Fintput%2F&work_group=primary"
athena_conn_obj = AthenaConnection(
awsConfig=awsCreds,
s3StagingDir=AnyUrl("s3athena-postgres", scheme="s3"),
s3StagingDir="s3://postgres/intput/",
workgroup="primary",
scheme=AthenaScheme.awsathena_rest,
)

View File

@ -38,7 +38,7 @@
},
"s3StagingDir": {
"title": "S3 Staging Directory",
"description": "S3 Staging Directory.",
"description": "S3 Staging Directory. Example: s3://postgres/input/",
"type": "string",
"format": "uri"
},