Skip to content

check_duplicate_sources

This check identifies instances where two different sources use the same raw database table.

Version History

Added in Debby v0.2.0

Parameters

This check does not support any custom parameters.

Info

For more information about how to set custom parameters for a check, see the documentation on configuration.

Source

def check(source: dict, manifest: Manifest):
    def get_compiled_source(source: dict):
        if source["database"]:
            return f"{source["database"]}.{source["schema"]}.{source["identifier"]}"
        else:
            return f"{source["schema"]}.{source["identifier"]}"

    compiled = get_compiled_source(source)

    for other in manifest.iter_sources():
        if other["unique_id"] == source["unique_id"]:
            continue
        assert not compiled == get_compiled_source(other)