Created
March 17, 2020 05:41
-
-
Save cuongld2/b0bbdf9d0a1f194727152a85a3e287c7 to your computer and use it in GitHub Desktop.
Access mysql db
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sqlalchemy import create_engine | |
from sqlalchemy.ext.declarative import declarative_base | |
from sqlalchemy.orm import sessionmaker | |
SQLALCHEMY_DATABASE_URL = "mysql+mysqlconnector://root:cuong1990@localhost:3306/restapi" | |
engine = create_engine( | |
SQLALCHEMY_DATABASE_URL, | |
) | |
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine) | |
Base = declarative_base() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment