Example #1
0
def create_schema(server, db_name, schema_name):
    connection = utils.get_db_connection(db_name,
                                         server['username'],
                                         server['db_password'],
                                         server['host'],
                                         server['port'],
                                         server['sslmode']
                                         )
    return schema_utils.create_schema(connection, schema_name)
Example #2
0
 def setUp(self):
     self.database_info = parent_node_dict["database"][-1]
     self.db_name = self.database_info["db_name"]
     # Change the db name, so that schema will create in newly created db
     self.schema_name = "schema_get_%s" % str(uuid.uuid4())[1:8]
     connection = utils.get_db_connection(
         self.db_name, self.server['username'], self.server['db_password'],
         self.server['host'], self.server['port'], self.server['sslmode'])
     self.schema_details = schema_utils.create_schema(
         connection, self.schema_name)
Example #3
0
    def setUp(self):
        self.db_name = "erdtestdb_{0}".format(str(uuid.uuid4())[1:8])
        self.sid = parent_node_dict["server"][-1]["server_id"]
        self.did = utils.create_database(self.server, self.db_name)

        try:
            self.sgid = config_data["server_group"]
            self.tables = [["erd1", "table_1"], ["erd2", "table_2"]]

            for tab in self.tables:
                connection = utils.get_db_connection(
                    self.db_name, self.server['username'],
                    self.server['db_password'], self.server['host'],
                    self.server['port'])
                schema_utils.create_schema(connection, tab[0])
                tables_utils.create_table(self.server, self.db_name, tab[0],
                                          tab[1])
                connection.close()
        except Exception as _:
            self.dropDB()
            raise
Example #4
0
 def setUp(self):
     super(CollationAddTestCase, self).setUp()
     self.database_info = parent_node_dict["database"][-1]
     self.db_name = self.database_info["db_name"]
     # Change the db name, so that schema will create in newly created db
     self.schema_name = "schema_get_%s" % str(uuid.uuid4())[1:8]
     connection = utils.get_db_connection(self.db_name,
                                          self.server['username'],
                                          self.server['db_password'],
                                          self.server['host'],
                                          self.server['port'],
                                          self.server['sslmode'])
     self.schema_details = schema_utils.create_schema(connection,
                                                      self.schema_name)