Re: Importing SQLite database

From: William Ivanski <william(dot)ivanski(at)gmail(dot)com>
To: Igor Korot <ikorot01(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Importing SQLite database
Date: 2016-12-08 13:40:41
Message-ID: CACaWZ9S+6qbiz+TZZREiBBpGF=8EW3QEcvVkN9XCmGN-cOtGGQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

OmniDB [1] is able to convert databases from one RDBMS to another. I
suggest you perform a conversion from your SQLite file to a PostgreSQL
database.
This page [2] can help you on how to add connections to OmniDB and this
other page [3] explains how to use the convert feature.

[1] http://www.omnidb.com.br/en_index.aspx
[2] https://github.com/OmniDB/OmniDB/wiki/3.-Creating-Users-and-Connections
[3] https://github.com/OmniDB/OmniDB/wiki/10.-Schema-Conversion

Em qui, 8 de dez de 2016 às 10:55, Igor Korot <ikorot01(at)gmail(dot)com> escreveu:

> Hi, ALL,
> I have a text file which I got from exporting the SQLite database.
>
> The file contains an SQL statement which will generate the database.
>
> Excerpt from this file:
>
> [code]
> CREATE TABLE leagues( id INTEGER AUTOINCREMENT PRIMARY KEY, name
> VARCHAR(100),balance DOUBLE(10,2));
> CREATE TABLE players(playerid INTEGER AUTOINCREMENT PRIMARY KEY,
> player_name VARCHAR(60), player_position CHAR(1));
> CREATE TABLE player_draft(id INTEGER, playerid INTEGER,
> drafted_position CHAR(1), FOREIGN KEY id REFERENCE leagues(id),
> FOREIGN KEY playerid REFERENCE players(playerid));
> INSERT INTO leagues VALUES(1, 'Test1', 260.00);
> INSERT INTO leagues VALUES(2, 'Test2', 260.00);
> INSERT INTO players VALUES(1, 'Player1', 'D');
> INSERT INTO players VALUES(2, ''Player2', 'F');
> [/code]
>
> My question would be:
> Is there a command in Postgres which will open this file and execute all
> those
> commands one-by-one in a transaction?
> Or I will have to do a manual table creation, then split this file and
> use "LOAD..."
> command to load the data into the tables?
>
> Hopefully I made myself clear.
> Let me know if not and I will try to clarify further.
>
> Thank you.
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>
--

William Ivanski

In response to

Browse pgsql-general by date

  From Date Subject
Next Message John DeSoi 2016-12-08 14:11:01 Re: PDF files: to store in database or not
Previous Message Rich Shepard 2016-12-08 13:40:34 Re: When to use COMMENT vs --