Thread: Data conversion tools?
I'm trying to convert a database from either MS Access or MySQL into Postgres. I have found a couple of tools that will almost do what I want - but not quite. To make things match up with code that is already written - I need to have all of the table names and column names converted to lower case during the conversion process. I have found a couple of (free or demo) tools that will do it - navicat has a tools that will convert from MSAccess to Postgres - however, it doesn't offer a feature to lowercase all of the table names and column names. DB Tools Manager Professional will do it as well - but again, no way to tell it to lowercase things in the process. PGAdmin II had a tool that would do this - but alas - that part of PGAdmin was never brought into PGAdmin III. And the last version of PGAdmin II that I was able to find wouldn't run against my Postgres DB. Short of installing an older Postgres DB that PGAdmin II will work with - does anyone else know of a tool that can do what I want? Is there a script of some sort that I can run that would go through a set of tables and lowercase everything? Thanks, Dan -- **************************** Daniel Armbrust Biomedical Informatics Mayo Clinic Rochester daniel.armbrust(at)mayo.edu http://informatics.mayo.edu/
If you don't mind an intermediate step you could use Pg2xbase http://www.klaban.torun.pl/prog/pg2xbase/ This program takes dbf files and inputs them into Postgres. It has an option for lower casing field names. You can specify the table name when you do the conversion. On Wednesday 15 November 2006 11:41 am, Dan Armbrust wrote: > I'm trying to convert a database from either MS Access or MySQL into > Postgres. I have found a couple of tools that will almost do what I > want - but not quite. To make things match up with code that is already > written - I need to have all of the table names and column names > converted to lower case during the conversion process. > > I have found a couple of (free or demo) tools that will do it - navicat > has a tools that will convert from MSAccess to Postgres - however, it > doesn't offer a feature to lowercase all of the table names and column > names. > > DB Tools Manager Professional will do it as well - but again, no way to > tell it to lowercase things in the process. > > PGAdmin II had a tool that would do this - but alas - that part of > PGAdmin was never brought into PGAdmin III. And the last version of > PGAdmin II that I was able to find wouldn't run against my Postgres DB. > > Short of installing an older Postgres DB that PGAdmin II will work with > - does anyone else know of a tool that can do what I want? > > Is there a script of some sort that I can run that would go through a > set of tables and lowercase everything? > > Thanks, > > Dan -- Adrian Klaver aklaver@comcast.net
On Nov 15, 2006, at 12:41 PM, Dan Armbrust wrote: > I'm trying to convert a database from either MS Access or MySQL > into Postgres. I have found a couple of tools that will almost do > what I want - but not quite. To make things match up with code > that is already written - I need to have all of the table names and > column names converted to lower case during the conversion process. Well, for tables it wouldn't be hard to craft a query that spits out the appropriate ALTER TABLE RENAME statements. Unfortunately, ALTER TABLE doesn't support renaming columns, but it might be safe to run an update on the system tables to accomplish that. -- Jim Nasby jim@nasby.net EnterpriseDB http://enterprisedb.com 512.569.9461 (cell)
On Thu, Nov 16, 2006 at 06:23:23PM -0700, Jim Nasby wrote: > Well, for tables it wouldn't be hard to craft a query that spits out > the appropriate ALTER TABLE RENAME statements. Unfortunately, ALTER > TABLE doesn't support renaming columns, but it might be safe to run > an update on the system tables to accomplish that. Sorry? # \h alter table <snip> ALTER TABLE [ ONLY ] name [ * ] RENAME [ COLUMN ] column TO new_column ALTER TABLE name RENAME TO new_name <snip> Have a nice day, -- Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/ > From each according to his ability. To each according to his ability to litigate.