Ejemplo n.º 1
0
def execute(sql):
    try:
        con = DB.connect()
        cursor = con.cursor()
        cursor.execute(sql)
        cursor.commit()
        msg = 'Query executed sucessfully.'
        # print(msg)
        return 'Success', msg
    except Exception as ex:
        msg = 'Executing Exception: {}'.format(ex)
        # print(msg)
        # print(sql)
        return 'Error', msg
Ejemplo n.º 2
0
    '08_survey_booklet_locations.sql': 'survey_booklet_locations',
    '09_task_categories.sql': 'task_categories',
    '18_task_ratings.sql': 'task_ratings',
    '17_task_statements.sql': 'task_statements',
    '27_tasks_to_dwas.sql': 'tasks_to_dwas',
    '29_tasks_to_green_dwas.sql': 'tasks_to_green_dwas',
    '34_tools_and_technology.sql': 'tools_and_technology',
    '33_unspsc_reference.sql': 'unspsc_reference',
    '19_work_activities.sql': 'work_activities',
    '10_work_context_categories.sql': 'work_context_categories',
    '20_work_context.sql': 'work_context',
    '21_work_styles.sql': 'work_styles',
    '22_work_values.sql': 'work_values'
}

conn = DB.connect(dev=True)

server = '10.101.2.74'
database = 'MDC_DEV'
username = '******'
password = '******'
driver = '{/usr/local/lib/libmsodbcsql.17.dylib}'
cs = 'DRIVER=' + driver + ';PORT=1433;SERVER=' + server + ';PORT=1443;DATABASE=' + database + ';UID=' + username + ';PWD=' + password


def make_connection():
    cx = pyodbc.connect(cs)
    return cx


def execute(sql):