예제 #1
0
def import_to_pg(table_name,ids,answer_file):
    conn = pg_operating.connect_postgres_server(PG_HOST, PG_PORT, PG_USER, PG_PASSWORD, PG_DATABASE)
    cur = conn.cursor()
    pg_operating.create_pg_table(conn, cur, table_name)
    pg_operating.record_txt(ids,answer_file)
    pg_operating.copy_data_to_pg(conn, cur, table_name)
    pg_operating.build_pg_index(conn, cur, table_name)
예제 #2
0
def init_table(table_name, client, conn, cursor):
    status, ok = has_table(table_name, client)
    print("has_table:", status, ok)
    if not ok:
        print("create collection.")
        create_table(table_name, client)
        create_index(table_name, client)
        create_pg_table(table_name, conn, cursor)
        build_pg_index(table_name, conn, cursor)