Ejemplo n.º 1
0
def verdict_connect(host, port):
    connection_string = 'jdbc:impala://%s:%s' % (host, port)

    return pyverdict.VerdictContext(
        connection_string,
        verdictdbmetaschema=TEST_META_SCHEMA_NAME,
    )
Ejemplo n.º 2
0
def verdict_connect(host, port, dbname, user):
    connection_string = 'jdbc:postgresql://%s:%s/%s?user=%s' % (
        host,
        port,
        dbname,
        user,
    )

    return pyverdict.VerdictContext(connection_string)
Ejemplo n.º 3
0
def setup_module(module):
    global presto_conn, verdict_conn

    hostport = 'localhost:8080'
    catalog = 'memory'
    user = '******'
    # hostport = os.environ['VERDICTDB_TEST_PRESTO_HOST']
    # catalog = os.environ['VERDICTDB_TEST_PRESTO_CATALOG']
    # user = os.environ['VERDICTDB_TEST_PRESTO_USER']
    host, port = hostport.split(':')
    port = int(port)
    password = ''

    # setup regular presto_conn
    presto_conn = prestodb.dbapi.connect(host=host,
                                         port=port,
                                         user=user,
                                         catalog=catalog)

    # create table and populate data
    cur = presto_conn.cursor()
    cur.execute("DROP TABLE IF EXISTS {}.{}".format(test_schema, test_table))
    cur.fetchall()
    cur.execute("DROP TABLE IF EXISTS {}.{}".format(test_schema,
                                                    test_scramble))
    cur.fetchall()
    cur.execute('DROP SCHEMA IF EXISTS {}'.format(test_schema))
    cur.fetchall()
    cur.execute('CREATE SCHEMA IF NOT EXISTS ' + test_schema)
    cur.fetchall()

    cur.execute("""
        CREATE TABLE IF NOT EXISTS {}.{} (
          intCol              INTEGER
        )""".format(test_schema, test_table))
    cur.fetchall()

    sql = 'insert into {}.{} values'.format(test_schema, test_table)
    for i in range(2000):
        if i == 0:
            sql = sql + ' '
        else:
            sql = sql + ', '
        sql = sql + '({:d})'.format(i)
    cur.execute(sql)
    cur.fetchall()

    # setup verdict_conn
    connection_string = \
        'jdbc:presto://{:s}:{:d}/{:s}?user={:s}'.format(host, port, catalog, user)
    verdict_conn = pyverdict.VerdictContext(connection_string)
    verdict_conn.sql('CREATE SCRAMBLE {}.{} FROM {}.{} BLOCKSIZE 200'.format(
        test_schema, test_scramble, test_schema, test_table))
Ejemplo n.º 4
0
def setup_module(module):
    global mysql_conn, verdict_conn

    host = 'localhost'
    port = 3306
    user = '******'
    password = ''

    # setup regular mysql_conn
    mysql_conn = pymysql.connect(host=host,
                                 port=port,
                                 user=user,
                                 passwd=password,
                                 autocommit=True)

    # create table and populate data
    cur = mysql_conn.cursor()
    cur.execute('DROP SCHEMA IF EXISTS ' + test_schema)
    cur.execute('CREATE SCHEMA IF NOT EXISTS ' + test_schema)
    cur.execute("""
        CREATE TABLE IF NOT EXISTS {}.{} (
          intCol              INT(4)
        )""".format(test_schema, test_table))
    sql = 'insert into {}.{} values'.format(test_schema, test_table)
    for i in range(2000):
        if i == 0:
            sql = sql + ' '
        else:
            sql = sql + ', '
        sql = sql + '({:d})'.format(i)
    cur.execute(sql)
    cur.close()

    # setup verdict_conn
    connection_string = \
        'jdbc:mysql://{:s}:{:d}?user={:s}&password={:s}'.format(host, port, user, password)
    verdict_conn = pyverdict.VerdictContext(connection_string)
    verdict_conn.sql('CREATE SCRAMBLE {}.{} FROM {}.{} BLOCKSIZE 200'.format(
        test_schema, test_scramble, test_schema, test_table))
Ejemplo n.º 5
0
def verdict_connect(host, port, catalog, usr):
    connection_string = \
        'jdbc:presto://{:s}:{:d}/{:s}?user={:s}'.format(host, port, catalog, usr)
    return pyverdict.VerdictContext(connection_string)
Ejemplo n.º 6
0
def verdict_connect(host, port, usr, pwd):
    connection_string = \
        'jdbc:mysql://{:s}:{:d}?user={:s}&password={:s}'.format(host, port, usr, pwd)
    return pyverdict.VerdictContext(connection_string)