Ejemplo n.º 1
0
def send_dummy_table(zmq_requestor, schema_version):

    table = qasino_table.QasinoTable(options.tablename)

    if int(schema_version) == 0:

        table.add_column("identity", "varchar")
        table.add_column("the", "int")
        table.add_column("quick", "int")
        table.add_column("brown", "varchar")
        table.add_column("fox", "varchar")
        table.add_row( [ Identity.get_identity(), 34, 5, "yes", "no" ] )
        table.add_row( [ Identity.get_identity(), 1000, 321, "zanzabar", strftime("%Y-%m-%d %H:%M:%S GMT", gmtime()) ] )

    else:
        table.add_column("identity", "varchar")
        table.add_column("the", "int")
        table.add_column("quick", "int")
        table.add_column("brown", "varchar")
        table.add_column("fox", "varchar")
        table.add_column("foo", "varchar")
        table.add_row( [ Identity.get_identity(), 34, 5, "yes", "no", "here I am!" ] )
        table.add_row( [ Identity.get_identity(), 1000, 321, "zanzabar", strftime("%Y-%m-%d %H:%M:%S GMT", gmtime()), "" ] )

    if options.persist:
        table.set_property("persist", 1)
    if options.static:
        table.set_property("static", 1)

    zmq_requestor.send_table(table)
Ejemplo n.º 2
0
def send_dummy_table(zmq_requestor, schema_version):

    table = qasino_table.QasinoTable(options.tablename)

    if int(schema_version) == 0:

        table.add_column("identity", "varchar")
        table.add_column("the", "int")
        table.add_column("quick", "int")
        table.add_column("brown", "varchar")
        table.add_column("fox", "varchar")
        table.add_row([Identity.get_identity(), 34, 5, "yes", "no"])
        table.add_row([
            Identity.get_identity(), 1000, 321, "zanzabar",
            strftime("%Y-%m-%d %H:%M:%S GMT", gmtime())
        ])

    else:
        table.add_column("identity", "varchar")
        table.add_column("the", "int")
        table.add_column("quick", "int")
        table.add_column("brown", "varchar")
        table.add_column("fox", "varchar")
        table.add_column("foo", "varchar")
        table.add_row(
            [Identity.get_identity(), 34, 5, "yes", "no", "here I am!"])
        table.add_row([
            Identity.get_identity(), 1000, 321, "zanzabar",
            strftime("%Y-%m-%d %H:%M:%S GMT", gmtime()), ""
        ])

    if options.persist:
        table.set_property("persist", 1)
    if options.static:
        table.set_property("static", 1)

    zmq_requestor.send_table(table)
Ejemplo n.º 3
0
    if table.get_property('persist'): properties.append(' persist')

    print "Sending{} table '{}' to '{}:{}' ({} rows).".format(''.join(properties), table.get_tablename(), options.hostname, options.port, table.get_nr_rows())

    if options.use_zmq:

        from txzmq import ZmqFactory
        import zmq_requestor

        zmq_factory = ZmqFactory()

        # Create a json request object.

        zmq_requestor = zmq_requestor.ZmqRequestor(options.hostname, options.port, zmq_factory)

        zmq_requestor.send_table(table)


    elif options.use_http or options.use_https:

        if options.use_https:
            url_proto = 'https'
            if options.port == constants.HTTP_PORT:
                options.port = constants.HTTPS_PORT
        else:
            url_proto = 'http'

        import requests

        conn = requests.Session()
Ejemplo n.º 4
0
        ''.join(properties), table.get_tablename(), options.hostname,
        options.port, table.get_nr_rows())

    if options.use_zmq:

        from txzmq import ZmqFactory
        import zmq_requestor

        zmq_factory = ZmqFactory()

        # Create a json request object.

        zmq_requestor = zmq_requestor.ZmqRequestor(options.hostname,
                                                   options.port, zmq_factory)

        zmq_requestor.send_table(table)

    elif options.use_http or options.use_https:

        if options.use_https:
            url_proto = 'https'
            if options.port == constants.HTTP_PORT:
                options.port = constants.HTTPS_PORT
        else:
            url_proto = 'http'

        import requests

        conn = requests.Session()

        request_options = {'headers': {'Content-Type': 'application/json'}}