Reputation: 967
I need to do an automatic periodic backup of specific Postgres table to Azure blob storage.
I am using "Azure database for Postgres" as database.
In that, I was having one table with millions of timeseries data. So, I have partitioned data day wise.
Now, I want to keep only last few days partitions and detach & drop older partitions after backing up on Azure blob storage.
For normal database operation I am using azure functions written in C# (using NPgsql nuget package).
Is there any way to performing backup/export programmatically?
I did some research but couldn't find any automated way. Even, Azure data migration service is not supporting postgres data backup on blob storage.
Upvotes: 2
Views: 1590
Reputation: 16722
I'd recommend exploring non-programmatic ways of doing full-database backup rather than attempting to do this programmatically. While PostgreSQL has pg_backup, which can be very easily be scripted to run periodically and have its output uploaded to blob storage, there's no built-in facility for doing this programmatically.
Otherwise you could look at exporting specific tables via Npgsql's bulk copy API, but that's not meant for full-database backup.
Upvotes: 2