Jason Motley
11/16/2021, 11:21 PMmysqlclient
Anaconda package won't run on my version of Python 3.8.8 but when I created a second conda environment on 3.7 I was told that it had a compatibility error with Prefect. Are there alternative ways to connect to a MySQL db using secrets & SSL args?. The specific error is: Error during execution of task: ModuleNotFoundError("No module named 'MySQLdb'")
Kevin Kho
Jason Motley
11/16/2021, 11:48 PMsqlalchemy
to create a database engine create_engine
in the task... let me provide a generic exampleJason Motley
11/16/2021, 11:48 PM@task(log_stdout=True)
def db_connection(credentials: dict) -> any:
import sqlalchemy as db
ssl_args = {args}
user = credentials['username']
password = credentials['password']
url = 'Our URL'
port = 1111
engine = db.create_engine(
f'mysql://{user}:{password}@{url}:{port}/?charset=utf8',
connect_args=ssl_args
)
return engine
Jason Motley
11/16/2021, 11:49 PMdb.create_engine
sectionJason Motley
11/16/2021, 11:49 PMKevin Kho
db.create_engine
is the one raising the ModuleNotFoundError
?Jason Motley
11/17/2021, 12:26 AMJason Motley
11/17/2021, 12:26 AMKevin Kho
Jason Motley
11/17/2021, 1:56 AMJason Motley
11/17/2021, 1:57 AMKevin Kho