Added global settings module

This commit is contained in:
Fredrick W. Warren 2018-08-21 13:40:51 -07:00
parent efe22e1c1a
commit 158a31d8e0
3 changed files with 24 additions and 2 deletions

View File

@ -1,8 +1,13 @@
import settings
import fredmssql import fredmssql
def get_birthdays(start, thru): def get_birthdays(start, thru):
db = fredmssql.FredDB(DATABASE_USER, DATABASE_PASS, DATABASE_NAME) db = fredmssql.FredDB(
settings.DATABASE_USER,
settings.DATABASE_PASS,
settings.DATABASE_NAME
)
s = (" SELECT e.EmpUID, e.LastName, e.FirstName, e.BirthDate " s = (" SELECT e.EmpUID, e.LastName, e.FirstName, e.BirthDate "
" FROM Employee e " " FROM Employee e "
"LEFT JOIN EmpCstFV c ON e.EmpUID = c.EmpUID AND c.CstID = 105 " "LEFT JOIN EmpCstFV c ON e.EmpUID = c.EmpUID AND c.CstID = 105 "
@ -26,7 +31,11 @@ def get_birthdays(start, thru):
def get_anniversary(start, thru): def get_anniversary(start, thru):
db = fredmssql.FredDB(DATABASE_USER, DATABASE_PASS, DATABASE_NAME) db = fredmssql.FredDB(
settings.DATABASE_USER,
settings.DATABASE_PASS,
settings.DATABASE_NAME
)
s = (" SELECT e.EmpUID, e.LastName, e.FirstName, e.HireDate " s = (" SELECT e.EmpUID, e.LastName, e.FirstName, e.HireDate "
" FROM Employee e " " FROM Employee e "
"LEFT JOIN EmpCstFV c ON e.EmpUID = c.EmpUID AND c.CstID = 105 " "LEFT JOIN EmpCstFV c ON e.EmpUID = c.EmpUID AND c.CstID = 105 "

12
settings.py Normal file
View File

@ -0,0 +1,12 @@
import os
from dotenv import load_dotenv
load_dotenv()
DATABASE_NAME = os.getenv("DATABASE_NAME")
DATABASE_USER = os.getenv("DATABASE_USER")
DATABASE_PASS = os.getenv("DATABASE_PASS")
if __name__ == "__main__":
pass

View File

@ -61,3 +61,4 @@ def get_date_range(date=''):
if __name__ == "__main__": if __name__ == "__main__":
pass pass