В словаре элементы в несортированном виде
parent
c280ab3d63
commit
c9741cca05
|
@ -11,22 +11,22 @@ conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
|
|||
|
||||
def create_schema():
|
||||
cur = conn.cursor()
|
||||
d = {
|
||||
lybcfg.pwd_table_name: lybtools.AUTH_SCHEMA,
|
||||
lybcfg.sess_table_name: lybtools.SESS_SCHEMA,
|
||||
lybcfg.cat_table_name: lybtools.CAT_SCHEMA,
|
||||
lybcfg.doc_table_name: lybtools.DOC_SCHEMA,
|
||||
lybcfg.bin_table_name: lybtools.BIN_SCHEMA,
|
||||
lybcfg.docbin_table_name: lybtools.DOCBIN_SCHEMA,
|
||||
lybcfg.grpcat_access_table: lybtools.GRPCAT_ACCESS_SCHEMA,
|
||||
lybcfg.grpdoc_access_table: lybtools.GRPDOC_ACCESS_SCHEMA,
|
||||
lybcfg.pwdcat_access_table: lybtools.PWDCAT_ACCESS_SCHEMA,
|
||||
lybcfg.pwddoc_access_table: lybtools.PWDDOC_ACCESS_SCHEMA
|
||||
}
|
||||
for k in d.keys():
|
||||
l = [
|
||||
(lybcfg.pwd_table_name, lybtools.AUTH_SCHEMA),
|
||||
(lybcfg.sess_table_name, lybtools.SESS_SCHEMA),
|
||||
(lybcfg.cat_table_name, lybtools.CAT_SCHEMA),
|
||||
(lybcfg.doc_table_name, lybtools.DOC_SCHEMA),
|
||||
(lybcfg.bin_table_name, lybtools.BIN_SCHEMA),
|
||||
(lybcfg.docbin_table_name, lybtools.DOCBIN_SCHEMA),
|
||||
(lybcfg.grpcat_access_table, lybtools.GRPCAT_ACCESS_SCHEMA),
|
||||
(lybcfg.grpdoc_access_table, lybtools.GRPDOC_ACCESS_SCHEMA),
|
||||
(lybcfg.pwdcat_access_table, lybtools.PWDCAT_ACCESS_SCHEMA),
|
||||
(lybcfg.pwddoc_access_table, lybtools.PWDDOC_ACCESS_SCHEMA)
|
||||
]
|
||||
for k in l:
|
||||
try:
|
||||
cur.execute('SELECT COUNT(*) FROM %s' % k)
|
||||
cur.execute('SELECT COUNT(*) FROM %s' % k[0])
|
||||
except:
|
||||
cur.execute(d[k])
|
||||
cur.execute(k[1])
|
||||
conn.commit()
|
||||
|
||||
|
|
Loading…
Reference in New Issue