0

I would like to ask if it´s possible to update a CSV with daily data (temperature, pressure, humidity, etc.. ) to PostgreSQL as a scheduled task.

I´d like to create a new table every time with format YYYYMMDD which can be uploaded automatically as a scheduled task on PostgreSQL.

I´ve seen there is a function called PGagent which I have installed but not sure about the use.

Many thanks

6
  • 1
    I´d like to create a new table every time with ... Why? What is the use of having a lot of tables with exactly the same structure? Commented Mar 19, 2017 at 15:47
  • Just to hold the monthly data, but if it´s not possible it will work for me just overwrite each time the same table with the same attributes but changing only time-stamp. Thanks Commented Mar 19, 2017 at 16:08
  • 1
    Why not add/append the new data, growing the table with every import? Commented Mar 19, 2017 at 16:15
  • Thanks wildplasser, I think that can be the idea, add new data to the table, but I still need an automated thing/script? that can upload automatically a CSV file to PostgreSQL every day. Commented Mar 19, 2017 at 16:21
  • You can automate that, either with cron(if you happen to live on Unix) or with something like PgAgent. Commented Mar 19, 2017 at 16:52

1 Answer 1

1

Just write some simple script using copy statement and run it via psql+cron or pgagent.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.