Ejemplo n.º 1
0
 def test_ways2bfmap(self):
     properties = dict(line.strip().split('=')
                       for line in open('/mnt/bfmap/test/test.properties'))
     bfmap.schema("localhost", 5432, properties[
                  "database"], "bfmap_ways", properties["user"], properties["password"], False)
     config = bfmap.config(properties["config"])
     bfmap.ways2bfmap("localhost", 5432, properties["database"], "temp_ways", properties["user"], properties[
                      "password"], "localhost", 5432, properties["database"], "bfmap_ways", properties["user"], properties["password"], config, False)
     return
Ejemplo n.º 2
0
 def test_ways2bfmap(self):
     properties = dict(line.strip().split('=')
                       for line in open('/mnt/bfmap/test/test.properties'))
     bfmap.schema("localhost", 5432, properties["database"], "bfmap_ways",
                  properties["user"], properties["password"], False)
     config = bfmap.config(properties["config"])
     bfmap.ways2bfmap("localhost", 5432, properties["database"],
                      "temp_ways", properties["user"],
                      properties["password"], "localhost", 5432,
                      properties["database"], "bfmap_ways",
                      properties["user"], properties["password"], config,
                      False)
     return
Ejemplo n.º 3
0
else:
    print("Table '%s' already exists in database '%s'." %
          (options.target_table, options.target_database))
    while True:
        value = raw_input(
            "Do you want to remove table '%s' (y/n)? [n]: " % options.target_table).lower()
        if value == '' or value == 'n':
            print("Cancelled by user.")
            exit(0)
        elif value == 'y':
            break
    bfmap.remove(options.target_host, options.target_port, options.target_database,
                 options.target_table, options.target_user, target_password, options.printonly)
    print("Table '%s' has been removed." % options.target_table)

bfmap.schema(options.target_host, options.target_port, options.target_database,
             options.target_table, options.target_user, target_password, options.printonly)
print("Table '%s' has been created." % options.target_table)

print("Inserting data ...")
bfmap.ways2bfmap(options.source_host, options.source_port, options.source_database,
                 options.source_table, options.source_user, source_password,
                 options.target_host, options.target_port, options.target_database,
                 options.target_table, options.target_user, target_password, config,
                 options.printonly)
print("Done.")

print("Setting up spatial index on table '%s' ... " % options.target_table)
bfmap.index(options.target_host, options.target_port, options.target_database,
            options.target_table, options.target_user, target_password, options.printonly)
print("Done.")
Ejemplo n.º 4
0
if options.target_password == None:
    target_password = getpass.getpass("Password (target database):")
else:
    target_password = options.target_password

config = bfmap.config(options.config)
print("Configuration imported.")

if not bfmap.exists(options.target_host, options.target_port,
                    options.target_database, options.target_table,
                    options.target_user, target_password):
    print("Table '%s' does not exist in database '%s'." %
          (options.target_table, options.target_database))
    bfmap.schema(options.target_host, options.target_port,
                 options.target_database, options.target_table,
                 options.target_user, target_password, options.printonly)
    print("Table '%s' has been created." % options.target_table)
else:
    print("Table '%s' already exists in database '%s'." %
          (options.target_table, options.target_database))
    if not options.append:
        while True:
            value = raw_input("Do you want to remove table '%s' (y/n)?: " %
                              options.target_table).lower()
            if value == 'n':
                print("Append data to table '%s'." % options.target_table)
                break
            elif value == 'y':
                bfmap.remove(options.target_host, options.target_port,
                             options.target_database, options.target_table,