In this project I implemented various actions with data by Django.
Deployed with docker: docker push enoshima/django_data_app:tagname
And then run: docker run --name data_cont -d -p 8000:8000 enoshima/django_data_app:latest
- If current ports are already used, then: first one is port which will be displayed and second one is the
port specified in theDockerfile
. Hence change first one to match to another port.
- Load from Excel to DB
- Exporting from DB with SQL-RAW actions
- Exporting from DB with Pandas actions
-
Actions considering loadingdata_processing
folder you can findview
which in-turn triggersInjector
to load data from Excel to DB- Read data from Excel via Pandas
- Map correct columns from Pandas to model in DB
- If col. is datetime, then change format to **not naive timezone**
- If col. is delta, then, depending on the cell format, convert to float and replace ',' if exists
- Use `generator` with `zip` to fill two cols. of DB simultaneously
- If POST is sent => load from Excel will be done + if DB isn't empty ->
clear()
at first - Depending on the URL, GET will retrieve and do actions with data either via SQL or Pandas
- when putting data from
db
to pandasDataFrame
, at first use same columns in df - How to figure out SQL table name in db?
- https://docs.djangoproject.com/en/3.2/topics/db/sql/#executing-custom-sql-directly
- look at folder where model is, take it lower case + _ + lower case of the model