Exemple #1
0
def __update_partitions(paths):
    alter = StringIO()
    alter.write("ALTER TABLE {0}.{1} ADD ")
    for path in paths:
        if path.sensitivity_level == sensitivity.SENSITIVITY_TYPE.NONE and path.buildid == '1.0.2' and (
                path.platform == 'Android' or path.platform == 'OSX'):
            alter.write(
                " PARTITION (idx_source='{1}', idx_bldid='{2}', idx_year='{3}', idx_month='{4}', idx_day='{5}', idx_hour='{6}', idx_platform='{7}', idx_event='{8}') LOCATION 's3://<bucket>/{0}/{1}/{2}/{3}/{4}/{5}/{6}/{7}/{8}/'"
                .format(path.sensitivity_level, path.source, path.buildid,
                        path.year, path.month, path.day, path.hour,
                        path.platform, path.event))

    query = Query(
        type('obj', (object, ),
             {c.ENV_STACK_ID: os.environ[c.ENV_DEPLOYMENT_STACK_ARN]}))
    query.execute(alter.getvalue())
Exemple #2
0
def query(request, sql, sync=False):    
    sql = sql["sql"]
    query = Query(os.environ[c.ENV_DEPLOYMENT_STACK_ARN])
    return query.execute(sql, sync = sync)