I have returned a python script to take postgresql database dump of particular tables, how can I get the dump of that particular tables one day or incremental data to a .sql file.
username = 'postgres'
port = 5432
date = time.strftime('%Y-%m-%d')
base = 'databasename'
if base == 'databasename':
filename = "%s/%s-%s.sql" % (fulldir, base, date)
os.popen("nice -n 19 pg_dump -C -t table1 -t table2 -t table3 -t table4 -F p -U%s -p%s %s > %s" % (username, port, base, filename))
print(base + "backup taken")