Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lock SQLAlchemy-utils version #1078

Merged
merged 3 commits into from
Sep 8, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions bentoml/yatai/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def is_sqlite_db(db_url):


def init_db(db_url):
from sqlalchemy_utils import database_exists
from sqlalchemy_utils import database_exists, create_database

extra_db_args = {'echo': True}

Expand All @@ -46,11 +46,9 @@ def init_db(db_url):
engine = create_engine(db_url, **extra_db_args)

if not database_exists(engine.url) and not is_sqlite_db(db_url):
raise BentoMLException(
f'Database does not exist or Database name is missing in config '
f'db.url: {db_url}'
)
create_all_or_upgrade_db(engine, db_url)
logger.debug(f'Creating BentoML database at {engine.url}')
create_database(engine.url)
yubozhao marked this conversation as resolved.
Show resolved Hide resolved
create_all_or_upgrade_db_tables(engine, db_url)

return sessionmaker(bind=engine)

Expand All @@ -68,7 +66,7 @@ def create_session(session_maker):
session.close()


def create_all_or_upgrade_db(engine, db_url):
def create_all_or_upgrade_db_tables(engine, db_url):
# alembic add a lot of import time, so we lazy import
from alembic import command
from alembic.config import Config
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"python-json-logger",
"requests",
"ruamel.yaml>=0.15.0",
"sqlalchemy-utils",
"sqlalchemy-utils==0.36.7",
yubozhao marked this conversation as resolved.
Show resolved Hide resolved
"sqlalchemy>=1.3.0",
"tabulate",
'contextvars;python_version < "3.7"',
Expand Down