This is a template for connect and extract data from DBMS using SQLAlchemy and Pyodbc.
The program are structured at this way:
│ .env │ .env.example │ .gitignore │ main.py │ requirements.txt │ ├───cfg │ database.py │ ├───output │ .gitkeep │ └───scripts │ .gitkeep │ ├───python │ script_example.py │ └───queries querie_example.py
Where:
database.py - responsible for setup the connection with DB
output/ - used for put output files from your exctract
scripts - folder that cotains your procedures, functions, querrys that will be called at the main.py
main.py - Program start point
.env - contains your connection and other envriomment variables. You will need to create that based on .env.example
requirements.txt - python packages setup
- SQLAlchemy
- pyodbc
- python-dotenv
- pandas (optional)
Clone this project and install the dependencies at requirements.txt
Setup your querrys and call them on main.py using the connection as the example on code.
Treat your data using your procedures on scripts/
Save/export your data as you like :)
Davi Milhome