minor formatting

master
JoYo 2019-02-19 23:04:45 +00:00
parent 6a1b056ed9
commit 42c7364589
3 changed files with 9 additions and 2 deletions

6
.gitignore vendored
View File

@ -1,3 +1,7 @@
__pycache__/
seed
out/
out/
build/
dist/
*.egg-info/
.vscode

View File

@ -13,12 +13,14 @@ now = '{0:%Y%m%dT%H%M%S}'.format(datetime.utcnow())
Base = declarative_base()
def db_config(path: Path) -> Session:
engine = create_engine(f'sqlite:///{path.resolve()}', native_datetime=True)
Base.metadata.create_all(engine)
session = Session(engine)
return session
class ScrapNode(Base):
__tablename__ = 'scrap_node'
ctime = Column(DateTime, default=datetime.utcnow)

View File

@ -70,7 +70,8 @@ def sins():
logger.info(f'db_path: {db_path}')
if args.seed:
exists = session.query(ScrapNode).filter(ScrapNode.checksum == seed.checksum)
exists = session.query(ScrapNode).filter(
ScrapNode.checksum == seed.checksum)
if exists:
seed = exists[0]