Skip to content
This repository has been archived by the owner on Apr 14, 2019. It is now read-only.

Commit

Permalink
Fix downloadnetfilerawdata import by standardizing schema
Browse files Browse the repository at this point in the history
The column headers in data/netfile/csv/netfile_cal201_transaction.csv
did not match the table schema, resulting in an import error.

I updated the corresponding model to match.
  • Loading branch information
tdooner committed Aug 14, 2016
1 parent b8f4241 commit 5fdb4b4
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 3 deletions.
38 changes: 38 additions & 0 deletions netfile_raw/migrations/0002_auto_20160814_2012.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


class Migration(migrations.Migration):

dependencies = [
('netfile_raw', '0001_initial'),
]

operations = [
migrations.AddField(
model_name='netfilecal201transaction',
name='filerLocalId',
field=models.CharField(default='Unknown', max_length=32, db_column='filerLocalId'),
preserve_default=False,
),
migrations.AddField(
model_name='netfilecal201transaction',
name='filerStateId',
field=models.CharField(default='Unknown', max_length=32, db_column='filerStateId'),
preserve_default=False,
),
migrations.AddField(
model_name='netfilecal201transaction',
name='filingEndDate',
field=models.DateField(default='1970-01-01', db_column='filingEndDate'),
preserve_default=False,
),
migrations.AddField(
model_name='netfilecal201transaction',
name='filingStartDate',
field=models.DateField(default='1970-01-01', db_column='filingStartDate'),
preserve_default=False,
),
]
14 changes: 11 additions & 3 deletions netfile_raw/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ class NetFileCal201Transaction(CalAccessBaseModel):
"""
Netfile 201 data.
"""
agency_shortcut = models.CharField(
max_length=32,
db_column='agency_shortcut')
agency_shortcut = models.CharField(max_length=32, db_column='agency_shortcut')
filerId = models.CharField(
max_length=32,
db_column='filerId')
Expand Down Expand Up @@ -75,6 +73,8 @@ class NetFileCal201Transaction(CalAccessBaseModel):
tran_NamT = models.CharField(
max_length=256,
db_column='tran_NamT')
filingStartDate = models.DateField(
db_column='filingStartDate')
tran_Dscr = models.CharField(
max_length=256,
db_column='tran_Dscr')
Expand Down Expand Up @@ -150,6 +150,8 @@ class NetFileCal201Transaction(CalAccessBaseModel):
intr_NamF = models.CharField(
max_length=256,
db_column='intr_NamF')
filingEndDate = models.DateField(
db_column='filingEndDate')
transactionType = models.IntegerField(
null=True,
db_column='transactionType')
Expand Down Expand Up @@ -255,6 +257,9 @@ class NetFileCal201Transaction(CalAccessBaseModel):
int_CmteId = models.CharField(
max_length=32,
db_column='int_CmteId')
filerLocalId = models.CharField(
max_length=32,
db_column='filerLocalId')
calculated_Date = models.DateField(
null=True,
db_column='calculated_Date')
Expand Down Expand Up @@ -288,6 +293,9 @@ class NetFileCal201Transaction(CalAccessBaseModel):
entity_Cd = models.CharField(
max_length=3,
db_column='entity_Cd')
filerStateId = models.CharField(
db_column='filerStateId',
max_length=32)
tres_Adr1 = models.CharField(
max_length=256,
db_column='tres_Adr1')
Expand Down

0 comments on commit 5fdb4b4

Please sign in to comment.