minor formatting
parent
6a1b056ed9
commit
42c7364589
|
@ -1,3 +1,7 @@
|
||||||
__pycache__/
|
__pycache__/
|
||||||
seed
|
seed
|
||||||
out/
|
out/
|
||||||
|
build/
|
||||||
|
dist/
|
||||||
|
*.egg-info/
|
||||||
|
.vscode
|
|
@ -13,12 +13,14 @@ now = '{0:%Y%m%dT%H%M%S}'.format(datetime.utcnow())
|
||||||
|
|
||||||
Base = declarative_base()
|
Base = declarative_base()
|
||||||
|
|
||||||
|
|
||||||
def db_config(path: Path) -> Session:
|
def db_config(path: Path) -> Session:
|
||||||
engine = create_engine(f'sqlite:///{path.resolve()}', native_datetime=True)
|
engine = create_engine(f'sqlite:///{path.resolve()}', native_datetime=True)
|
||||||
Base.metadata.create_all(engine)
|
Base.metadata.create_all(engine)
|
||||||
session = Session(engine)
|
session = Session(engine)
|
||||||
return session
|
return session
|
||||||
|
|
||||||
|
|
||||||
class ScrapNode(Base):
|
class ScrapNode(Base):
|
||||||
__tablename__ = 'scrap_node'
|
__tablename__ = 'scrap_node'
|
||||||
ctime = Column(DateTime, default=datetime.utcnow)
|
ctime = Column(DateTime, default=datetime.utcnow)
|
||||||
|
|
|
@ -70,7 +70,8 @@ def sins():
|
||||||
logger.info(f'db_path: {db_path}')
|
logger.info(f'db_path: {db_path}')
|
||||||
|
|
||||||
if args.seed:
|
if args.seed:
|
||||||
exists = session.query(ScrapNode).filter(ScrapNode.checksum == seed.checksum)
|
exists = session.query(ScrapNode).filter(
|
||||||
|
ScrapNode.checksum == seed.checksum)
|
||||||
|
|
||||||
if exists:
|
if exists:
|
||||||
seed = exists[0]
|
seed = exists[0]
|
||||||
|
|
Loading…
Reference in New Issue