How to Execute MS Access Macro (functions/ queries/ forms) via Python?
Recently we got a task to help other teams take over couples of tools, forms and reports. One of tool is MS Access based form that pulls sales data via ODBC and store it in the Access DB itself. Since there is a limitation of size per Access DB file, we plan to move the SQL query part from Access to Teradata and Access only handle the Form/Macro/VBA parts.
We won’t cover SQL migration in this session while we will focus on how to use Python drive Teradata query through Macro and execute the Macro stored in Access DB.
Run Query in Teradata
Required Package: teradata
Steps:
- You will need to have a file udaExec.ini stored in the same folder of py code and this file include your connection credential. Please ensure your name of ODBC setup is “Teradata”.
# Application Configuration
[CONFIG]
appName=CSVtry
version=1.0
logConsole=False
dataSourceName=Teradata
# Default Data Source Configuration
[DEFAULT]
method=odbc
charset=UTF8
# Data Source Definition
[Teradata]
dsn=Teradata
username= informula
password= passcode
2. Execute the macro you defined in Teradata.
Execute Macro in Access