def table():
    usage = '%prog dburl table [edgemart]'
    op = optparse.OptionParser(usage=usage)
    op.add_option('--wsdl', default='wsdl_partner.xml')
    options, args = op.parse_args()
    username, password, token = get_credentials(op)

    dburl = get_arg(op, args, 'missing dburl, [postgres://username:password@localhost/database]')
    schema, table = get_schema_table(op, args)
    edgemart = get_arg(op, args, default=table)

    metadata = db.metadata_dict(dburl, table, schema=schema)
    data = db.data_generator(dburl, table, schema=schema)

    uploader = AnalyticsCloudUploader(metadata, data)
    uploader.login(options.wsdl, username, password, token)
    uploader.upload(edgemart)
示例#2
0
def upload():
    usage = '%prog metadata.json data.csv [edgemart]'
    op = optparse.OptionParser(usage=usage)
    op.add_option('--wsdl', default=WSDL)
    options, args = op.parse_args()
    username, password, token = get_credentials(op)

    metadata = get_arg(op, args, 'missing metadata.json')
    metadata = json.loads(open(metadata, 'r').read())

    datafile = get_arg(op, args, 'missing datafile.csv')
    data = unicodecsv.reader(open(datafile))

    edgemart = get_arg(op, args, default=metadata['objects'][0]['name'])

    uploader = AnalyticsCloudUploader(metadata, data)
    uploader.login(options.wsdl, username, password, token)
    uploader.upload(edgemart)
示例#3
0
def upload():
    usage = '%prog metadata.json data.csv [edgemart]'
    op = optparse.OptionParser(usage=usage)
    op.add_option('--wsdl', default=WSDL)
    options, args = op.parse_args()
    username, password, token = get_credentials(op)

    metadata = get_arg(op, args, 'missing metadata.json')
    metadata = json.loads(open(metadata, 'r').read())

    datafile = get_arg(op, args, 'missing datafile.csv')
    data = unicodecsv.reader(open(datafile))

    edgemart = get_arg(op, args, default=metadata['objects'][0]['name'])

    uploader = AnalyticsCloudUploader(metadata, data)
    uploader.login(options.wsdl, username, password, token)
    uploader.upload(edgemart)
示例#4
0
def table():
    usage = '%prog dburl table [edgemart]'
    op = optparse.OptionParser(usage=usage)
    op.add_option('--wsdl', default='wsdl_partner.xml')
    options, args = op.parse_args()
    username, password, token = get_credentials(op)

    dburl = get_arg(
        op, args,
        'missing dburl, [postgres://username:password@localhost/database]')
    schema, table = get_schema_table(op, args)
    edgemart = get_arg(op, args, default=table)

    metadata = db.metadata_dict(dburl, table, schema=schema)
    data = db.data_generator(dburl, table, schema=schema)

    uploader = AnalyticsCloudUploader(metadata, data)
    uploader.login(options.wsdl, username, password, token)
    uploader.upload(edgemart)