Exemplo n.º 1
0
def _create_table(cursor):
    location_one_row = "{0}{1}/{2}/".format(ENV.s3_staging_dir, S3_PREFIX, "one_row")
    location_many_rows = "{0}{1}/{2}/".format(
        ENV.s3_staging_dir, S3_PREFIX, "many_rows"
    )
    location_one_row_complex = "{0}{1}/{2}/".format(
        ENV.s3_staging_dir, S3_PREFIX, "one_row_complex"
    )
    location_partition_table = "{0}{1}/{2}/".format(
        ENV.s3_staging_dir, S3_PREFIX, "partition_table"
    )
    location_integer_na_values = "{0}{1}/{2}/".format(
        ENV.s3_staging_dir, S3_PREFIX, "integer_na_values"
    )
    location_boolean_na_values = "{0}{1}/{2}/".format(
        ENV.s3_staging_dir, S3_PREFIX, "boolean_na_values"
    )
    location_execute_many = "{0}{1}/{2}/".format(
        ENV.s3_staging_dir,
        S3_PREFIX,
        "execute_many_{0}".format(str(uuid.uuid4()).replace("-", "")),
    )
    for q in read_query(os.path.join(BASE_PATH, "sql", "create_table.sql")):
        cursor.execute(
            q.format(
                schema=SCHEMA,
                location_one_row=location_one_row,
                location_many_rows=location_many_rows,
                location_one_row_complex=location_one_row_complex,
                location_partition_table=location_partition_table,
                location_integer_na_values=location_integer_na_values,
                location_boolean_na_values=location_boolean_na_values,
                location_execute_many=location_execute_many,
            )
        )
Exemplo n.º 2
0
def _create_table(cursor):
    location_one_row = '{0}{1}/{2}/'.format(
        ENV.s3_staging_dir, S3_PREFIX, 'one_row')
    location_many_rows = '{0}{1}/{2}/'.format(
        ENV.s3_staging_dir, S3_PREFIX, 'many_rows')
    location_one_row_complex = '{0}{1}/{2}/'.format(
        ENV.s3_staging_dir, S3_PREFIX, 'one_row_complex')
    location_partition_table = '{0}{1}/{2}/'.format(
        ENV.s3_staging_dir, S3_PREFIX, 'partition_table')
    location_integer_na_values = '{0}{1}/{2}/'.format(
        ENV.s3_staging_dir, S3_PREFIX, 'integer_na_values')
    location_boolean_na_values = '{0}{1}/{2}/'.format(
        ENV.s3_staging_dir, S3_PREFIX, 'boolean_na_values')
    location_execute_many = '{0}{1}/{2}/'.format(
        ENV.s3_staging_dir, S3_PREFIX, 'execute_many_{0}'.format(
            str(uuid.uuid4()).replace('-', '')))
    location_execute_many_pandas = '{0}{1}/{2}/'.format(
        ENV.s3_staging_dir, S3_PREFIX, 'execute_many_pandas_{0}'.format(
            str(uuid.uuid4()).replace('-', '')))
    for q in read_query(
            os.path.join(BASE_PATH, 'sql', 'create_table.sql')):
        cursor.execute(q.format(schema=SCHEMA,
                                location_one_row=location_one_row,
                                location_many_rows=location_many_rows,
                                location_one_row_complex=location_one_row_complex,
                                location_partition_table=location_partition_table,
                                location_integer_na_values=location_integer_na_values,
                                location_boolean_na_values=location_boolean_na_values,
                                location_execute_many=location_execute_many,
                                location_execute_many_pandas=location_execute_many_pandas))
Exemplo n.º 3
0
def _create_table(cursor):
    location_one_row = '{0}{1}/{2}/'.format(
        _ENV.s3_staging_dir, 'test_pyathena_jdbc', 'one_row')
    location_many_rows = '{0}{1}/{2}/'.format(
        _ENV.s3_staging_dir, 'test_pyathena_jdbc', 'many_rows')
    location_one_row_complex = '{0}{1}/{2}/'.format(
        _ENV.s3_staging_dir, 'test_pyathena_jdbc', 'one_row_complex')
    for q in read_query(
            os.path.join(_BASE_PATH, 'sql', 'create_table.sql')):
        cursor.execute(q, location_one_row=location_one_row,
                       location_many_rows=location_many_rows,
                       location_one_row_complex=location_one_row_complex)
Exemplo n.º 4
0
def _create_table(cursor):
    location_one_row = '{0}{1}/{2}/'.format(
        ENV.s3_staging_dir, S3_PREFIX, 'one_row')
    location_many_rows = '{0}{1}/{2}/'.format(
        ENV.s3_staging_dir, S3_PREFIX, 'many_rows')
    location_one_row_complex = '{0}{1}/{2}/'.format(
        ENV.s3_staging_dir, S3_PREFIX, 'one_row_complex')
    location_partition_table = '{0}{1}/{2}/'.format(
        ENV.s3_staging_dir, S3_PREFIX, 'partition_table')
    for q in read_query(
            os.path.join(BASE_PATH, 'sql', 'create_table.sql')):
        cursor.execute(q.format(schema=SCHEMA,
                                location_one_row=location_one_row,
                                location_many_rows=location_many_rows,
                                location_one_row_complex=location_one_row_complex,
                                location_partition_table=location_partition_table))
Exemplo n.º 5
0
def _drop_database(cursor):
    for q in read_query(os.path.join(_BASE_PATH, 'sql', 'drop_database.sql')):
        cursor.execute(q)
Exemplo n.º 6
0
def _drop_database(cursor):
    for q in read_query(os.path.join(BASE_PATH, "sql", "drop_database.sql")):
        cursor.execute(q.format(schema=SCHEMA))
Exemplo n.º 7
0
def _create_database(cursor):
    for q in read_query(os.path.join(BASE_PATH, 'sql', 'create_database.sql')):
        cursor.execute(q.format(schema=SCHEMA))
Exemplo n.º 8
0
def _drop_database(cursor):
    for q in read_query(os.path.join(_BASE_PATH, 'sql', 'drop_database.sql')):
        cursor.execute(q.format(schema=_SCHEMA))
Exemplo n.º 9
0
def _create_table(cursor):
    for q in read_query(
        "create_table.sql.jinja2", s3_staging_dir=ENV.s3_staging_dir, schema=ENV.schema
    ):
        cursor.execute(q)
Exemplo n.º 10
0
def _drop_database(cursor):
    for q in read_query("drop_database.sql.jinja2", schema=ENV.schema):
        cursor.execute(q)