def upgrade(context): logging.debug("Execute upgrade of `%d`" % version) template = Template(""" CREATE TABLE IF NOT EXISTS qubole_bi_${env}_${account_id}.tco_table ( node_id BIGINT, cluster_inst_id INT, cluster_id INT, instance_type STRING, availability_zone STRING, region STRING, hour BIGINT, price DOUBLE, node_run_time INT, approx_per_hour_price DOUBLE, ondemand_price DOUBLE, up_time STRING, down_time STRING, node_type STRING ) PARTITIONED BY (account_id INT, event_date STRING) STORED AS ORC LOCATION '${defloc}/qubole_bi/tco_table/' """) context["revisions.upgraded"].append(version) Migrations.upgrade( migration_number=version, command=HiveCommand.run( query=template.render_unicode(env=context["env"], account_id=context['account_id'], defloc=context['defloc']))) print context
def upgrade(context): logging.debug("Execute upgrade of `%d`" % version) template = Template(""" CREATE DATABASE IF NOT EXISTS qubole_bi_${env}_${account_id}; """) context["revisions.upgraded"].append(version) Migrations.upgrade( migration_number=version, command=HiveCommand.run(query=template.render_unicode( env=context["env"], account_id=context['account_id']))) print context
def upgrade(context): logging.debug("Execute upgrade of `%d`" % version) template = Template(""" CREATE EXTERNAL TABLE IF NOT EXISTS qubole_bi_${env}_${account_id}.clusters_metadata2 ( cluster_id STRING, cluster_inst_id STRING, tag STRING, ec2_tag STRING ) PARTITIONED BY (account_id INT, event_date STRING) STORED AS ORC Location '${defloc}/qubole_bi/clusters_metadata2/' """) context["revisions.upgraded"].append(version) Migrations.upgrade(migration_number=version, command=HiveCommand.run(query=template.render_unicode(env=context["env"], account_id = context['account_id'], defloc = context['defloc']))) print context
def upgrade(context): logging.debug("Execute upgrade of `%d`" % version) template = Template(""" CREATE EXTERNAL TABLE IF NOT EXISTS qubole_bi_${env}_${account_id}.queries_info ( command_id STRING, engine STRING, similarity_identifier STRING, similarity_payload MAP<STRING, STRING>, counters MAP<STRING, STRING>, cluster_id INT) PARTITIONED BY (account_id INT, event_date STRING) STORED AS ORC LOCATION '${defloc}/qubole_bi/queries_info/' """) context["revisions.upgraded"].append(version) Migrations.upgrade( migration_number=version, command=HiveCommand.run( query=template.render_unicode(env=context["env"], account_id=context['account_id'], defloc=context['defloc']))) print context
def upgrade(context): logging.debug("Execute upgrade of `%d`" % version) template = Template(""" CREATE EXTERNAL TABLE IF NOT EXISTS qubole_bi_${env}_${account_id}.`usage`( `cluster_id` INT, `cluster_inst_id` INT, `node_type` STRING, `cluster_type` STRING, `compute_usage` DECIMAL(30,8)) PARTITIONED BY ( `account_id` INT, `event_date` STRING) STORED AS ORC LOCATION '${defloc}/qubole_bi/qcuh/' """) context["revisions.upgraded"].append(version) Migrations.upgrade( migration_number=version, command=HiveCommand.run( query=template.render_unicode(env=context["env"], account_id=context['account_id'], defloc=context['defloc']))) print context