Skip to content

Commit 5daa970

Browse files
committed
Add mysql-connector SQLAlchemy ORM
1 parent bc607f6 commit 5daa970

4 files changed

Lines changed: 1015 additions & 3 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# aws_advanced_python_wrapper/sqlalchemy/sqlalchemy_mysqlconnector_dialect.py
2+
from psycopg import Connection
3+
from sqlalchemy.dialects.mysql.mysqlconnector import MySQLDialect_mysqlconnector
4+
import re
5+
6+
from aws_advanced_python_wrapper import AwsWrapperConnection
7+
8+
9+
class SqlAlchemyOrmMysqlDialect(MySQLDialect_mysqlconnector):
10+
"""
11+
SQLAlchemy dialect for AWS Advanced Python Wrapper with mysqlconnector. Extends the SQLAlchemy MySQL mysqlconnector dialect.
12+
This dialect is not related to the DriverDialect or DatabaseDialect classes used by our driver. Instead, it is used
13+
directly by SQLAlchemy. This dialect is registered in pyproject.toml and is selected by prefixing the connection
14+
string passed to create_engine with "mysql+aws_wrapper_mysqlconnector://" ("[name]+[driver]").
15+
"""
16+
17+
name = 'mysql'
18+
driver = 'aws_wrapper_mysqlconnector'
19+

aws_advanced_python_wrapper/sqlalchemy/orm_dialect.py renamed to aws_advanced_python_wrapper/sqlalchemy/pg_orm_dialect.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ class SqlAlchemyOrmPgDialect(PGDialect_psycopg):
1111
SQLAlchemy dialect for AWS Advanced Python Wrapper with psycopg. Extends the SQLAlchemy PostgreSQL psycopg dialect.
1212
This dialect is not related to the DriverDialect or DatabaseDialect classes used by our driver. Instead, it is used
1313
directly by SQLAlchemy. This dialect is registered in pyproject.toml and is selected by prefixing the connection
14-
string passed to create_engine with "postgresql+aws_wrapper://" ("[name]+[driver]").
14+
string passed to create_engine with "postgresql+aws_wrapper_psycopg://" ("[name]+[driver]").
1515
"""
1616

1717
name = 'postgresql'
18-
driver = 'aws_wrapper'
18+
driver = 'aws_wrapper_psycopg'
1919

2020
def __init__(self, **kwargs):
2121
# PGDialect_psycopg's __init__ function checks the driver version and raises an exception if it is lower than

0 commit comments

Comments
 (0)