This repo provides tools for fast DB integration of data from the Dallas Central Appraisal District (DCAD). This includes
- A parser for DCAD's table exports for parsing, coersion, and validation.
- A CLI that uses the parsed schema and flask-sqlacodegen to generate SQLAlchemy models.
Parse the Dallas Central Appraisal District (DCAD) data dictionary into
sqlalchemy metadata. Use the generated metadata to generate
Flask-SQLAlchemy model code, using flask-sqlacodegen
.
This will convert this data dictionary structure:
TABLE [ABATEMENT_EXEMPT] Table containing information for abatement if applicable [ACCOUNT_NUM] The DCAD Account number [APPRAISAL_YR] The appraisal year for the data [TOT_VAL] The total value for the property
into
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
class AbatementExempt(db.Model):
__tablename__ = 'abatement_exempt'
account_num = db.Column(db.Integer, primary_key=True, nullable=False, info='The DCAD Account number')
appraisal_yr = db.Column(db.Integer, primary_key=True, nullable=False, info='The appraisal year for the data')
tot_val = db.Column(db.Float, info='The total value for the property')
Example (using the entery point)
generate_sqlalchemy path/to/file.txt --outfile models.py --flask
To see the full list of options
generate_sqlalchemy --help
This parser functions as a dictionary parser for the invidual table exports. It also coerces and validates the data. It uses the same naming convention logic to identify field types as the Data Model process.
pip install dcad-parser-hydrospanner