Create dockerfile, changed apply_commits method
This commit is contained in:
32
test.py
Normal file
32
test.py
Normal file
@@ -0,0 +1,32 @@
|
||||
import db
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
|
||||
def get_branch(bndname: str, scheme: str):
|
||||
conn = db.connect_db()
|
||||
with Session(conn) as session:
|
||||
item = session.query(db.IncomeBranch).filter_by(scheme=scheme).join(db.User).filter_by(bndname=bndname).one_or_none()
|
||||
if item:
|
||||
return item.branch
|
||||
return None
|
||||
|
||||
|
||||
def is_replication_scheme(bndname: str, scheme: str):
|
||||
conn = db.connect_db()
|
||||
with Session(conn) as session:
|
||||
item = session.query(db.User).filter_by(bndname=bndname).one_or_none()
|
||||
if not item:
|
||||
return False
|
||||
profiles = {x.scheme: x.to_dict() for x in item.profiles}
|
||||
if len(profiles) == 0 or scheme in profiles:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def main():
|
||||
# print(get_branch('bnd128', 'ood'))
|
||||
print(is_replication_scheme('bnd128', 'documents_src'))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user