Created
March 14, 2021 17:53
-
-
Save justinhchae/a1fa4ad457381b2d24e1c4572887fc92 to your computer and use it in GitHub Desktop.
sample_schema.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Budget2021(BudgetDB.base): | |
__tablename__ = "budget2021" | |
# uncomment the following line to print out this class as text | |
# df = get_vars_main('budget_main.csv') | |
id = Column(Integer, primary_key=True) | |
fund_type = Column(String) | |
# the code is a value like 4355 that means "Department A" -> F key to the table the name of the dept. | |
department_code = Column(Integer, ForeignKey("departmentDescription.department_code")) | |
fund_code = Column(String, ForeignKey("fundDescription.fund_code")) | |
organization_code = Column(Integer) | |
organization_description = Column(String) | |
division_code = Column(String) | |
division_description = Column(String) | |
section_code = Column(String, ForeignKey("sectionDescription.section_code")) | |
sub_section_code = Column(Integer) | |
sub_section_description = Column(String) | |
schedule_grade = Column(String) | |
bargaining_unit = Column(Integer) | |
title_code = Column(String, ForeignKey("titleDescription.title_code")) | |
budgeted_unit = Column(String) | |
position_control = Column(Integer) | |
budgeted_pay_rate = Column(Integer) | |
total_budgeted_amount = Column(Integer) | |
total_budgeted_unit_people = Column(String) | |
total_budgeted_unit_time = Column(String) | |
section_description = relationship("SectionDescription", back_populates="main", uselist=True) | |
fund_description = relationship("FundDescription", back_populates="main", uselist=True) | |
title_description = relationship("TitleDescription", back_populates="main", uselist=True) | |
# use relationship and back population to merge code with description | |
department_description = relationship("DepartmentDescription", back_populates="main", uselist=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment