I have a simple script I'd like to run
connection_string = 'mysql+pymysql://example@example.com'
engine = sa.create_engine(connection_string)
connection = engine.connect()
query = """
select distinct n.listname, n.notes
from notes n
join run r on n.start = r.start
where r.branch = 'B_HEAD'
and r.start > '2015-08-01'
and n.notes like '%ug%';"""
result = connection.execute(query)
for row in result:
print("listname: {} | notes: {}".format(row['listname'], row["notes"]))
The problem is that PyMySQL isn't Python3 compatible. There is, however, a PyMySQL3.
but if I try to use that module as my connector I get
sqlalchemy.exc.NoSuchModuleError: Can't load plugin: sqlalchemy.dialects:mysql.pymysql3
Is there a simple way to make SQLAlchemy and PyMySQL3 play nice? Baring that is there a way to create custom connectors for SQLAlchemy?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire