Skip to content
This repository has been archived by the owner on Jun 10, 2024. It is now read-only.

Commit

Permalink
Fixed db inconsistency (#779)
Browse files Browse the repository at this point in the history
* Fixed db creation inconsistency in taskdb, projectdb and resultdb

* Fixed typo
  • Loading branch information
jxltom authored and binux committed Apr 8, 2018
1 parent a203a77 commit 1e45731
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pyspider/database/sqlalchemy/resultdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ def __init__(self, url):
database = self.url.database
self.url.database = None
try:
engine = create_engine(self.url, convert_unicode=True,
pool_recycle=3600)
engine.execute("CREATE DATABASE IF NOT EXISTS %s" % database)
engine = create_engine(self.url, convert_unicode=True, pool_recycle=3600)
conn = engine.connect()
conn.execute("commit")
conn.execute("CREATE DATABASE %s" % database)
except sqlalchemy.exc.SQLAlchemyError:
pass
self.url.database = database
Expand Down

0 comments on commit 1e45731

Please sign in to comment.