pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedbacking up the data from a single table?
5+ messages / 5 participants
[nested] [flat]
* backing up the data from a single table?
@ 2019-09-13 14:13 stan <stanb@panix.com>
2019-09-13 14:17 ` Re: backing up the data from a single table? Ray O'Donnell <ray@rodonnell.ie>
2019-09-13 14:27 ` Re: backing up the data from a single table? Ron <ronljohnsonjr@gmail.com>
2019-09-13 14:39 ` Re: backing up the data from a single table? Hans Schou <hans.schou@gmail.com>
2019-09-13 14:44 ` Re: backing up the data from a single table? Olivier Gautherot <ogautherot@gautherot.net>
0 siblings, 4 replies; 5+ messages in thread
From: stan @ 2019-09-13 14:13 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
My development methodology is to create scripts that init the db, and load
test data, as I make changes.
Now, I am starting to move toward a test instance with real data. The end
user has provided "real" test data, n spreadsheets. I have the inputing of
data from these working OK. (takes a bit of hand work). What I would like
to do, is continue to init the "test" database. To make that easy, I would
like to be able to "export" individual tables, so I can use the scripts to
reload them. I prefer not to have to convert these to my load script
format.
Is there a way to "export" a single table, that can be easily re
"imported"?
--
"They that would give up essential liberty for temporary safety deserve
neither liberty nor safety."
-- Benjamin Franklin
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: backing up the data from a single table?
2019-09-13 14:13 backing up the data from a single table? stan <stanb@panix.com>
@ 2019-09-13 14:17 ` Ray O'Donnell <ray@rodonnell.ie>
3 siblings, 0 replies; 5+ messages in thread
From: Ray O'Donnell @ 2019-09-13 14:17 UTC (permalink / raw)
To: stan <stanb@panix.com>; pgsql-general@lists.postgresql.org
On 13/09/2019 15:13, stan wrote:
> My development methodology is to create scripts that init the db, and load
> test data, as I make changes.
>
> Now, I am starting to move toward a test instance with real data. The end
> user has provided "real" test data, n spreadsheets. I have the inputing of
> data from these working OK. (takes a bit of hand work). What I would like
> to do, is continue to init the "test" database. To make that easy, I would
> like to be able to "export" individual tables, so I can use the scripts to
> reload them. I prefer not to have to convert these to my load script
> format.
>
> Is there a way to "export" a single table, that can be easily re
> "imported"?
Yes, absolutely:
pg_dump -t <table-name> (etc)
Ray.
--
Raymond O'Donnell // Galway // Ireland
ray@rodonnell.ie
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: backing up the data from a single table?
2019-09-13 14:13 backing up the data from a single table? stan <stanb@panix.com>
@ 2019-09-13 14:27 ` Ron <ronljohnsonjr@gmail.com>
3 siblings, 0 replies; 5+ messages in thread
From: Ron @ 2019-09-13 14:27 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
On 9/13/19 9:13 AM, stan wrote:
> My development methodology is to create scripts that init the db, and load
> test data, as I make changes.
>
> Now, I am starting to move toward a test instance with real data. The end
> user has provided "real" test data, n spreadsheets. I have the inputing of
> data from these working OK. (takes a bit of hand work). What I would like
> to do, is continue to init the "test" database. To make that easy, I would
> like to be able to "export" individual tables, so I can use the scripts to
> reload them. I prefer not to have to convert these to my load script
> format.
>
> Is there a way to "export" a single table, that can be easily re
> "imported"?
The COPY command is what you want.
http://postgresguide.com/utilities/copy.html
https://www.postgresql.org/docs/9.6/sql-copy.html
--
Angular momentum makes the world go 'round.
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: backing up the data from a single table?
2019-09-13 14:13 backing up the data from a single table? stan <stanb@panix.com>
@ 2019-09-13 14:39 ` Hans Schou <hans.schou@gmail.com>
3 siblings, 0 replies; 5+ messages in thread
From: Hans Schou @ 2019-09-13 14:39 UTC (permalink / raw)
To: stan <stanb@panix.com>; +Cc: pgsql-general@lists.postgresql.org
On Fri, Sep 13, 2019 at 4:14 PM stan <stanb@panix.com> wrote:
> Is there a way to "export" a single table, that can be easily re
> "imported"?
>
Export:
pg_dump --table=foo > foo.sql
Import:
cat foo.sql | psql
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: backing up the data from a single table?
2019-09-13 14:13 backing up the data from a single table? stan <stanb@panix.com>
@ 2019-09-13 14:44 ` Olivier Gautherot <ogautherot@gautherot.net>
3 siblings, 0 replies; 5+ messages in thread
From: Olivier Gautherot @ 2019-09-13 14:44 UTC (permalink / raw)
To: stan <stanb@panix.com>; +Cc: pgsql-general@lists.postgresql.org
Hi Stan,
El vie., 13 de septiembre de 2019 11:14, stan <stanb@panix.com> escribió:
> My development methodology is to create scripts that init the db, and load
> test data, as I make changes.
>
> Now, I am starting to move toward a test instance with real data. The end
> user has provided "real" test data, n spreadsheets. I have the inputing of
> data from these working OK. (takes a bit of hand work). What I would like
> to do, is continue to init the "test" database. To make that easy, I would
> like to be able to "export" individual tables, so I can use the scripts to
> reload them. I prefer not to have to convert these to my load script
> format.
>
> Is there a way to "export" a single table, that can be easily re
> "imported"?
>
>
> --
> "They that would give up essential liberty for temporary safety deserve
> neither liberty nor safety."
> -- Benjamin Franklin
>
It may be a strange suggestion but did you consider containers like Docker?
It's been a great help on a 100GB+ test database. Successful changes were
committed, failed changes were rolled back creating a new instance based on
the same image (with data preloaded). It takes seconds to do a rollback.
Olivier
>
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2019-09-13 14:44 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-09-13 14:13 backing up the data from a single table? stan <stanb@panix.com>
2019-09-13 14:17 ` Ray O'Donnell <ray@rodonnell.ie>
2019-09-13 14:27 ` Ron <ronljohnsonjr@gmail.com>
2019-09-13 14:39 ` Hans Schou <hans.schou@gmail.com>
2019-09-13 14:44 ` Olivier Gautherot <ogautherot@gautherot.net>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox