示例#1
0
    def test_3_drop_table(self):
        config = configparser.ConfigParser()
        config.read(os.path.dirname(
            os.path.dirname(os.path.realpath(__file__))) +
            "/agd_tools/config.ini"
        )
        schema = config["PostgreSQL"]["schema"]

        table_name = "iris_unittest"
        drop = pg.execute_sql("DROP TABLE " + schema + "." + table_name + "",
            commit=True)
        results = pg.execute_sql("SELECT COUNT(relname) "
                                 "FROM pg_class WHERE relname='"
                                 "" + table_name + "'")
        self.assertEqual(0, results['count'][0])
示例#2
0
 def test_1_export_table(self):
     table_name = "iris_unittest"
     iris = pd.read_csv("tests/iris.csv")
     pg.export_df(df=iris, table_name=table_name)
     results = pg.execute_sql("SELECT COUNT(relname) " +
                              "FROM pg_class WHERE relname='" +
                              table_name + "'")
     self.assertEqual(1, results['count'][0])