diff --git a/.gitignore b/.gitignore index 1637cdf..9553242 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ __pycache__/ seed -out/ \ No newline at end of file +out/ +build/ +dist/ +*.egg-info/ +.vscode \ No newline at end of file diff --git a/sins/orm.py b/sins/orm.py index c122b56..e6a3fdd 100644 --- a/sins/orm.py +++ b/sins/orm.py @@ -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) diff --git a/sins/run.py b/sins/run.py index fd49d58..2a5bbb4 100755 --- a/sins/run.py +++ b/sins/run.py @@ -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]