Skip to content

Instantly share code, notes, and snippets.

@zztalker
Created January 7, 2017 16:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zztalker/50044aa7178f39ae194df9c209d9829a to your computer and use it in GitHub Desktop.
Save zztalker/50044aa7178f39ae194df9c209d9829a to your computer and use it in GitHub Desktop.
example
s = file.readline()
for e in file.readlines():
l = e.split('\t')
row = db.docs(doc_id=l[0])
if not row:
db.docs.insert(doc_id=l[0],type_doc1=l[1],type_doc2=l[2],type_doc3=l[3],
surname1 = l[4], name1 = l[5], patronymic1 = l[6],
surname2 = l[7], name2 = l[8], patronymic2 = l[9])
rec = db.doc_status.insert(doc_id=l[0],status=l[10],status_ex=l[11],date_change=l[12])
else:
row.update_record(type_doc1=l[1],type_doc2=l[2],type_doc3=l[3],
surname1 = l[4], name1 = l[5], patronymic1 = l[6],
surname2 = l[7], name2 = l[8], patronymic2 = l[9])
rec = db.doc_status(doc_id=l[0])
if not rec:
db.doc_status.insert(doc_id=l[0],status=l[10],status_ex=l[11],date_change=l[12])
else:
rec.update_record(status=l[10],status_ex=l[11],date_change=l[12])
response.flash = "Данные загружены!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment