forked from LachubCz/pero-quality-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchange_pages.py
27 lines (22 loc) · 957 Bytes
/
change_pages.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import choix
import networkx as nx
import numpy as np
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy import func
from app.db import Base, User, Annotation, Crop, Page, Record, Set, RecordCrop
if __name__ == "__main__":
engine = create_engine('sqlite:///database.sqlite3',
convert_unicode=True,
connect_args={'check_same_thread': False})
db_session = scoped_session(sessionmaker(autocommit=False,
autoflush=False,
bind=engine))
Base.query = db_session.query_property()
Base.metadata.create_all(bind=engine)
pages = Page.query.all()
for i, item in enumerate(pages):
if item.path[0] == "i":
item.path = "/mnt/data/pero_quality_web_data/" + item.path
print("Change")
db_session.commit()