def __init__(
        self,
        model,
        csv_path,
        mapping,
        using=None,
        delimiter=',',
        null=None,
        encoding=None,
        static_mapping=None
    ):
        self.model = model
        self.mapping = mapping
        if os.path.exists(csv_path):
            self.csv_path = csv_path
        else:
            raise ValueError("csv_path does not exist")
        if using is not None:
            self.using = using
        else:
            self.using = router.db_for_write(model)
        self.conn = connections[self.using]
        if self.conn.vendor != 'postgresql':
            raise TypeError("Only PostgreSQL backends supported")
        self.backend = self.conn.ops
        self.delimiter = delimiter
        self.null = null
        self.encoding = encoding
        if static_mapping is not None:
            self.static_mapping = OrderedDict(static_mapping)
        else:
            self.static_mapping = {}

        # Connect the headers from the CSV with the fields on the model
        self.field_header_crosswalk = []
        inverse_mapping = {v: k for k, v in self.mapping.items()}
        for h in self.get_headers():
            try:
                f_name = inverse_mapping[h]
            except KeyError:
                raise ValueError("Map does not include %s field" % h)
            try:
                f = [f for f in self.model._meta.fields if f.name == f_name][0]
            except IndexError:
                raise ValueError("Model does not include %s field" % f_name)
            self.field_header_crosswalk.append((f, h))

        # Validate that the static mapping columns exist
        for f_name in self.static_mapping.keys():
            try:
                [s for s in self.model._meta.fields if s.name == f_name][0]
            except __HOLE__:
                raise ValueError("Model does not include %s field" % f_name)

        self.temp_table_name = "temp_%s" % self.model._meta.db_table
dataset/ETHPy150Open california-civic-data-coalition/django-postgres-copy/postgres_copy/__init__.py/CopyMapping.__init__