updated mysql connector

This commit is contained in:
mpabi 2024-06-23 16:33:57 +00:00
parent c7933373c4
commit 4f121e4ed0
1 changed files with 7 additions and 1 deletions

View File

@ -9,7 +9,7 @@ engine = create_engine(
)
"""
SQLALCHEMY_DATABASE_URL = "mysql+mysqlconnector://root:secret@172.18.0.2:3306/test" # Przykład dla MySQL
SQLALCHEMY_DATABASE_URL = "mysql+mysqlconnector://root:secret@src_mysql-server_1:3306/test" # Przykład dla MySQL
engine = create_engine(
SQLALCHEMY_DATABASE_URL,
)
@ -18,3 +18,9 @@ SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
Base = declarative_base()
#%%
from sqlalchemy import text
with engine.connect() as conn:
result = conn.execute(text("select 'hello world'"))
print(result.all())