awswrangler.mysql.connect

awswrangler.mysql.connect(connection: str, catalog_id: Optional[str] = None, boto3_session: Optional[boto3.session.Session] = None, read_timeout: Optional[int] = None, write_timeout: Optional[int] = None, connect_timeout: int = 10) → pymysql.connections.Connection

Return a pymysql connection from a Glue Catalog Connection.

https://pymysql.readthedocs.io

Parameters
Returns

pymysql connection.

Return type

pymysql.connections.Connection

Examples

>>> import awswrangler as wr
>>> con = wr.mysql.connect("MY_GLUE_CONNECTION")
>>> with con.cursor() as cursor:
>>>     cursor.execute("SELECT 1")
>>>     print(cursor.fetchall())
>>> con.close()