Пример #1
0
def run_setup(options, default, schema=None):
	config = None
	if options.config:
		config = options.config
	yf = fetch_config(default, config)
	if schema:
		yf['database']['database'] = schema
	return db_connect(yf['database'])
Пример #2
0
def run_setup(options, default, schema=None):
    config = None
    if options.config:
        config = options.config
    yf = fetch_config(default, config)
    if schema:
        yf['database']['database'] = schema
    return db_connect(yf['database'])
def main():
    parser = optionParser()
    (options, args) = parser.parse_args()
    if len(args) != 2:
        sys.stderr.write("usage: %prog [options] [name] [field name]\n")
        sys.exit(1)
    yf = fetch_config('crashreports/database', options.config)
    conn = db_connect(yf['database'])
    create(conn, args[0], args[1])
def main():
	parser = optionParser()
	(options, args) = parser.parse_args()
	if len(args) != 2:
		sys.stderr.write("usage: %prog [options] [name] [field name]\n")
		sys.exit(1)
	yf = fetch_config('crashreports/database', options.config)
	conn = db_connect(yf['database'])
	create(conn, args[0], args[1])
Пример #5
0
def execute(table_base, default, schema=None):
	parser = optionParser()
	(options, args) = parser.parse_args()
	config = None
	if options.config:
		config = options.config
	yf = fetch_config(default, config)
	if schema:
		yf['database']['database'] = schema
	conn = db_connect(yf['database'])
	try:
		if options.ver:
			report(conn, table_base)
		elif options.down:
			down(conn, table_base, int(options.down))
		else:
			up(conn, table_base)
	finally:
		conn.close()
Пример #6
0
def execute(table_base, default, schema=None):
    parser = optionParser()
    (options, args) = parser.parse_args()
    config = None
    if options.config:
        config = options.config
    yf = fetch_config(default, config)
    if schema:
        yf['database']['database'] = schema
    conn = db_connect(yf['database'])
    try:
        if options.ver:
            report(conn, table_base)
        elif options.down:
            down(conn, table_base, int(options.down))
        else:
            up(conn, table_base)
    finally:
        conn.close()