В словаре элементы в несортированном виде

master
Бородин Роман 2019-01-17 11:36:12 +03:00
parent c280ab3d63
commit c9741cca05
1 changed files with 15 additions and 15 deletions

View File

@ -11,22 +11,22 @@ conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
def create_schema(): def create_schema():
cur = conn.cursor() cur = conn.cursor()
d = { l = [
lybcfg.pwd_table_name: lybtools.AUTH_SCHEMA, (lybcfg.pwd_table_name, lybtools.AUTH_SCHEMA),
lybcfg.sess_table_name: lybtools.SESS_SCHEMA, (lybcfg.sess_table_name, lybtools.SESS_SCHEMA),
lybcfg.cat_table_name: lybtools.CAT_SCHEMA, (lybcfg.cat_table_name, lybtools.CAT_SCHEMA),
lybcfg.doc_table_name: lybtools.DOC_SCHEMA, (lybcfg.doc_table_name, lybtools.DOC_SCHEMA),
lybcfg.bin_table_name: lybtools.BIN_SCHEMA, (lybcfg.bin_table_name, lybtools.BIN_SCHEMA),
lybcfg.docbin_table_name: lybtools.DOCBIN_SCHEMA, (lybcfg.docbin_table_name, lybtools.DOCBIN_SCHEMA),
lybcfg.grpcat_access_table: lybtools.GRPCAT_ACCESS_SCHEMA, (lybcfg.grpcat_access_table, lybtools.GRPCAT_ACCESS_SCHEMA),
lybcfg.grpdoc_access_table: lybtools.GRPDOC_ACCESS_SCHEMA, (lybcfg.grpdoc_access_table, lybtools.GRPDOC_ACCESS_SCHEMA),
lybcfg.pwdcat_access_table: lybtools.PWDCAT_ACCESS_SCHEMA, (lybcfg.pwdcat_access_table, lybtools.PWDCAT_ACCESS_SCHEMA),
lybcfg.pwddoc_access_table: lybtools.PWDDOC_ACCESS_SCHEMA (lybcfg.pwddoc_access_table, lybtools.PWDDOC_ACCESS_SCHEMA)
} ]
for k in d.keys(): for k in l:
try: try:
cur.execute('SELECT COUNT(*) FROM %s' % k) cur.execute('SELECT COUNT(*) FROM %s' % k[0])
except: except:
cur.execute(d[k]) cur.execute(k[1])
conn.commit() conn.commit()