示例#1
0
    def test_get_tables_from_properties(self):
        """Test getting selected tables from tap properties JSON"""
        # Load MySQL and Postgres properties JSON
        mysql_properties = utils.load_json(
            '{}/properties_mysql.json'.format(RESOURCES_DIR))
        postgres_properties = utils.load_json(
            '{}/properties_postgres.json'.format(RESOURCES_DIR))

        # Get list of selected tables
        # MySQL and Postgres schemas defined at different keys. get_tables_from_properties function
        # should detect and extract correctly
        mysql_tables = utils.get_tables_from_properties(mysql_properties)
        postgres_tables = utils.get_tables_from_properties(postgres_properties)

        # MySQL schema
        assert mysql_tables == \
               [
                   'mysql_source_db.address',
                   'mysql_source_db.order',
                   'mysql_source_db.weight_unit'
               ]

        assert postgres_tables == \
               [
                   'public.city',
                   'public.country'
               ]
示例#2
0
    def test_get_tables_from_properties_for_s3_csv(self):
        properties = utils.load_json(
            '{}/properties_s3_csv.json'.format(RESOURCES_DIR))

        s3_csv_tables = utils.get_tables_from_properties(properties)

        # MySQL schema
        assert s3_csv_tables == {
            'applications',
            'candidate_survey_questions',
            'interviews',
        }