python - Adding data from csv file to database using django -
i have django model follows: class traxiorelations(models.model): corgemeente = models.charfield(max_length=100, null=true) coradres = models.charfield(max_length=255, null=true) corhuisnr = models.charfield(max_length=10, null=true, blank=true) that model creates table in database id follows: now want add records csv file model. csv file follows: i use copy command follows: copy master_traxiorelations(corgemeente, coradres, corhuisnr) '/path/to/file.csv' csv header delimiter ';' encoding 'iso-8859-1'; and when execute it, error follows: [2017-08-21 15:50:49] [22p04] error: data after last expected column but when add id copy command, copy master_traxiorelations(id, corgemeente, coradres, corhuisnr) and csv file also: then works fine. how can add data file database, without adding id copy command , csv file? i solved adding id model follows: id = models.autofield(primary_key=true) adding id = models.au...