Jago6060 Posted September 18, 2009 Share Posted September 18, 2009 Hi all, I've spent some time googling trying to find a tut to show me how to load data into a postgresql database but haven't found anything that great. Can anyone point me in the direction of a good one? Quote Link to comment https://forums.phpfreaks.com/topic/174726-solved-loading-data-from-a-csv-file/ Share on other sites More sharing options...
artacus Posted September 18, 2009 Share Posted September 18, 2009 http://www.postgresql.org/docs/8.3/static/sql-copy.html Quote Link to comment https://forums.phpfreaks.com/topic/174726-solved-loading-data-from-a-csv-file/#findComment-920915 Share on other sites More sharing options...
Jago6060 Posted September 23, 2009 Author Share Posted September 23, 2009 http://www.postgresql.org/docs/8.3/static/sql-copy.html Ok Just one quick question...the table that I'm importing a CSV into has some 20+ columns/fields but I need to copy csvfile.column1 into table.column18. Via your provided link, I can't see a way to delineate what columns of the CSV file go into what columns of the table. Quote Link to comment https://forums.phpfreaks.com/topic/174726-solved-loading-data-from-a-csv-file/#findComment-923445 Share on other sites More sharing options...
artacus Posted September 23, 2009 Share Posted September 23, 2009 No, you won't be able to do that with copy. Is this a one time thing or is it something you need to process on a continual basis? If it's a one time thing you can copy/reorder the columns in Excel. You have several options for continual process. One would be to copy to a staging table and then transform into your regular table. There is pgloader. It will allow you to do transforms before outputting to copy. http://www.postgresql.org/docs/8.3/static/pgcrypto.html Another option would be to use an ETL tool. There are loads of them out there. Quote Link to comment https://forums.phpfreaks.com/topic/174726-solved-loading-data-from-a-csv-file/#findComment-923641 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.