Skip to content
Snippets Groups Projects
Commit aa4d0446 authored by jvfpw18's avatar jvfpw18
Browse files

Add year_column to settings

parent 40935ab7
No related branches found
No related tags found
2 merge requests!13v1.1.0,!8Add year_column to settings
......@@ -836,7 +836,7 @@ class DatabaseTable(Table):
fk_column = ttable.columns.get(fk_column.name)
query = query.where(fk_column == fkey)
if year:
query = query.where(ttable.c.ano_censo == year)
query = query.where(ttable.columns.get(settings.YEAR_COLUMN) == year)
yield query
def apply_derivatives(self, ttable, columns, year, bind=None, dbonly=False):
......@@ -908,7 +908,7 @@ class DatabaseTable(Table):
for fk_column, fkey in fk_tuples:
selecter = selecter.where(fk_column == fkey)
if year:
selecter = selecter.where(self.c.ano_censo == year)
selecter = selecter.where(self.columns.get(settings.YEAR_COLUMN) == year)
query = update(self).values(**{column.name: selecter})
......
......@@ -35,6 +35,9 @@ DATABASE_HOST = 'localhost'
# Database to connect to
DATABASE = 'hotmapper_demo'
# Column used to run aggregations and denormalizations
YEAR_COLUMN = 'ano_censo'
# URI structure. Standards to login:password model, but can be changed as needed.
DATABASE_URI = '{}://{}:{}@{}/{}'.format(DATABASE_DIALECT, DATABASE_USER,
DATABASE_USER_PASSWORD, DATABASE_HOST, DATABASE)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment