Skip to content

Conversation

@kukushking
Copy link
Contributor

@kukushking kukushking commented Apr 26, 2021

Issue #554:

Description of changes:
Pass SSL properties from Glue Connection to PyMySQL. ~~Depends on this PyMySQL PR merged & released first. ~~

UPD: In conversation with PyMySQL contributors it seems it's possible to pass SSLContext to PyMySQL so extra argument is not required anymore.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@jaidisido
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: GitHubCodeBuild8756EF16-sDRE8Pq0duHT
  • Commit ID: 735ad12
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@kukushking kukushking changed the title Pass SSL properties from Glue Connection to PyMySQL Pass SSL properties from Glue Connection to MySQL Apr 26, 2021
@jaidisido jaidisido self-requested a review May 5, 2021 17:06
@jaidisido jaidisido added the enhancement New feature or request label May 5, 2021
@kukushking kukushking force-pushed the mysql_ssl_support branch from 735ad12 to 35706a3 Compare May 6, 2021 13:34
@jaidisido
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: GitHubCodeBuild8756EF16-sDRE8Pq0duHT
  • Commit ID: 35706a3
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@kukushking kukushking force-pushed the mysql_ssl_support branch from 35706a3 to cd19540 Compare May 6, 2021 13:42
@kukushking kukushking marked this pull request as ready for review May 6, 2021 13:49
@jaidisido
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: GitHubCodeBuild8756EF16-sDRE8Pq0duHT
  • Commit ID: cd19540
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@kukushking
Copy link
Contributor Author

@jaidisido CB failed here because a new aws-data-wrangler-mysql-ssl connection that I added in this PR isn't available in the test infra yet. How do we usually go about it? Do I need to deploy manually?

@jaidisido
Copy link
Contributor

Ideally, we would want to make this change permanent if it will be needed for future tests. So I would add/modify the cloudformation template holding the connections first (you can change it as part of this PR). I would then update the stack in the AWS account we are using for testing

@kukushking
Copy link
Contributor Author

That modification is already there (see diff). All, right, I'll update it in the account then.

@aws aws deleted a comment from jaidisido May 6, 2021
@aws aws deleted a comment from jaidisido May 6, 2021
@jaidisido
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: GitHubCodeBuild8756EF16-sDRE8Pq0duHT
  • Commit ID: cd19540
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Copy link
Contributor

@jaidisido jaidisido left a comment

Choose a reason for hiding this comment

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

Looking great, thank you. I have left minor comments

read_timeout=read_timeout,
write_timeout=write_timeout,
connect_timeout=connect_timeout,
ssl=attrs.ssl_context,
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor - I would put this line right after the host=attrs.host (line 137) just to keep all attributes arguments together

host=secret_value["host"],
port=secret_value["port"],
database=_dbname,
ssl_context=None,
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess there is really no way to specify/pass the ca data via secrets manager... Do you think we should clarify the docs in that regard?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doesn't hurt to clarify, of course.

CatalogId:
Ref: AWS::AccountId
ConnectionInput:
Description: Connect to Aurora (MySQL).
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor - "Connect to Aurora (MySQL) SSL enabled."

Comment on lines 27 to 28
def test_connection_ssl():
wr.mysql.connect("aws-data-wrangler-mysql-ssl", connect_timeout=10).close()
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think we should be not only testing the ssl connection, but also use that connection for some of the mysql test queries? Was wondering if we could adapt the current pytest fixture to take ssl enabled as an argument.

Something along the lines of:


@pytest.fixture(scope="function")
def mysql_con(ssl_enabled: bool = False):
    con_str = "aws-data-wrangler-mysql-ssl" if ssl_enabled else "aws-data-wrangler-mysql"
    con = wr.mysql.connect(con_str)
    yield con
    con.close()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I feel like it's a bit overkill to test all queries but deffo agree that there should be at least one with SSL enabled. In addition, I was thinking to run ALTER ... REQUIRE SSL; to replicate the same test that was mentioned in the original issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed, it's an overkill. One or two tests should be enough!

@jaidisido
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: GitHubCodeBuild8756EF16-sDRE8Pq0duHT
  • Commit ID: 0dcccbc
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@jaidisido
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: GitHubCodeBuild8756EF16-sDRE8Pq0duHT
  • Commit ID: 2b283ed
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@jaidisido jaidisido merged commit a697e2d into aws:main May 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants