Skip to content

Commit

Permalink
Change the functionality of the command-line argument related to db e…
Browse files Browse the repository at this point in the history
…ngine
  • Loading branch information
mertyildiran committed Jan 6, 2019
1 parent f8a8395 commit 874ddcc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions dragonfire/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ def start(args, userin):
userin: :class:`dragonfire.utilities.TextToAction` instance.
"""

if args["sqlite"]:
engine = create_engine('sqlite:///dragonfire.db', connect_args={'check_same_thread': False}, echo=True)
else:
if 'TRAVIS' in os.environ or args["db"] == "mysql":
engine = create_engine('mysql+pymysql://' + Config.MYSQL_USER + ':' + Config.MYSQL_PASS + '@' + Config.MYSQL_HOST + '/' + Config.MYSQL_DB)
else:
engine = create_engine('sqlite:///dragonfire.db', connect_args={'check_same_thread': False}, echo=True)
Base.metadata.create_all(engine)
Base.metadata.bind = engine
DBSession = sessionmaker(bind=engine)
Expand Down Expand Up @@ -659,7 +659,7 @@ def initiate():
ap.add_argument("--server", help="Server mode. Disable any audio functionality, serve a RESTful spaCy API and become a Twitter integrated chatbot.", metavar="REG_KEY")
ap.add_argument("-p", "--port", help="Port number for server mode.", default="3301", metavar="PORT")
ap.add_argument("--version", help="Display the version number of Dragonfire.", action="store_true")
ap.add_argument("--sqlite", help="Use SQLite as the database engine.", action="store_true")
ap.add_argument("--db", help="Specificy the database engine for the knowledge base of learning feature. Values: 'mysql' for MySQL, 'sqlite' for SQLite. Default database engine is SQLite.", action="store", type=str)
args = vars(ap.parse_args())
if args["version"]:
import pkg_resources
Expand Down

0 comments on commit 874ddcc

Please sign in to comment.