How to convert SQLite SQL dump file to PostgreSQL? - Stack Overflow (../../../cdn.sstatic.net/Sites/stackoverflow/Img/favicon.ico@v=ec617d715196) (https://cdn.sstatic.net/Sites/stackoverflow/Img/apple-touch-icon.png?v=c78bd457575a) (https://cdn.sstatic.net/Sites/stackoverflow/Img/apple-touch-icon.png?v=c78bd457575a) (Stack Overflow) (https://stackoverflow.com/opensearch.xml) (how-to-convert-sqlite-sql-dump-file-to-postgresql.html) (../../../cdn.sstatic.net/Shared/stacks.css@v=b2264ccf0463.css) (../../../cdn.sstatic.net/Sites/stackoverflow/primary.css@v=1172447e1393.css) (Feed for question 'How to convert SQLite SQL dump file to PostgreSQL?') (https://stackoverflow.com/feeds/question/4581727) (../../../cdn.sstatic.net/Shared/Channels/channels.css@v=2c98e83b4da0.css) (how-to-convert-sqlite-sql-dump-file-to-postgresql.html#content) Skip to main content (how-to-convert-sqlite-sql-dump-file-to-postgresql.html#) (https://stackoverflow.com) Stack Overflow (https://stackoverflow.co/) About Products (https://stackoverflow.co/teams/) For Teams (https://stackoverflow.co/teams/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=top-nav&utm_content=stack-overflow-for-teams) Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers (https://stackoverflow.co/advertising/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=top-nav&utm_content=stack-overflow-advertising) Advertising Reach devs & technologists worldwide about your product, service or employer brand (https://stackoverflow.co/api-solutions/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=top-nav&utm_content=overflow-api) Knowledge Solutions Data licensing offering for businesses to build and improve AI tools and models (https://stackoverflow.co/labs/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=top-nav&utm_content=labs) Labs The future of collective knowledge sharing (https://stackoverflow.co/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=top-nav&utm_content=about-the-company) About the company (https://stackoverflow.blog/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=top-nav&utm_content=blog) Visit the blog (Search…) () Loading… (https://stackoverflow.com) current community (https://stackoverflow.com) (Stack Overflow) Stack Overflow (https://stackoverflow.com/help) help (https://chat.stackoverflow.com/?tab=explore) chat (https://meta.stackoverflow.com) (Meta Stack Overflow) Meta Stack Overflow your communities (https://stackoverflow.com/users/signup?ssrc=site_switcher&returnurl=https%3a%2f%2fstackoverflow.com%2fquestions%2f4581727%2fhow-to-convert-sqlite-sql-dump-file-to-postgresql) Sign up or (https://stackoverflow.com/users/login?ssrc=site_switcher&returnurl=https%3a%2f%2fstackoverflow.com%2fquestions%2f4581727%2fhow-to-convert-sqlite-sql-dump-file-to-postgresql) log in to customize your list. (https://stackexchange.com/sites) more stack exchange communities (https://stackoverflow.blog) company blog (Click to show search) (https://stackoverflow.com/users/login?ssrc=head&returnurl=https%3a%2f%2fstackoverflow.com%2fquestions%2f4581727%2fhow-to-convert-sqlite-sql-dump-file-to-postgresql) Log in (https://stackoverflow.com/users/signup?ssrc=head&returnurl=https%3a%2f%2fstackoverflow.com%2fquestions%2f4581727%2fhow-to-convert-sqlite-sql-dump-file-to-postgresql) Sign up (https://stackoverflow.com/) Home (https://stackoverflow.com/questions) Questions (https://stackoverflow.ai) AI Assist Labs (https://stackoverflow.com/tags) Tags (https://stackoverflow.com/beta/challenges) Challenges (https://chat.stackoverflow.com/rooms/259507/stack-overflow-lobby) Chat (https://stackoverflow.blog/contributed?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=so-blog&utm_content=experiment-articles) Articles (https://stackoverflow.com/users) Users (https://stackoverflow.com/jobs?source=so-left-nav) Jobs (https://stackoverflow.com/jobs/companies?so_medium=stackoverflow&so_source=SiteNav) Companies Collectives Communities for your favorite technologies. (https://stackoverflow.com/collectives-all) Explore all Collectives Teams () Ask questions, find answers and collaborate at work with Stack Overflow for Teams. (https://stackoverflowteams.com/teams/create/free/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=side-bar&utm_content=explore-teams) Try Teams for free (https://stackoverflow.co/teams/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=side-bar&utm_content=explore-teams) Explore Teams Teams Ask questions, find answers and collaborate at work with Stack Overflow for Teams. (https://stackoverflow.co/teams/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=side-bar&utm_content=explore-teams-compact) Explore Teams Collectives™ on Stack Overflow Find centralized, trusted content and collaborate around the technologies you use most. (https://stackoverflow.com/collectives) Learn more about Collectives Teams Q&A for work Connect and share knowledge within a single location that is structured and easy to search. (https://stackoverflow.co/teams/) Learn more about Teams (https://cdn.sstatic.net/Sites/stackoverflow/Img/apple-touch-icon.png?v=c78bd457575a) (how-to-convert-sqlite-sql-dump-file-to-postgresql.html) How to convert SQLite SQL dump file to PostgreSQL? (https://stackoverflow.com/questions/ask) Ask Question (2011-01-03 02:33:26Z) Asked 14 years, 9 months ago Modified (https://stackoverflow.com/questions/4581727/how-to-convert-sqlite-sql-dump-file-to-postgresql?lastactivity) (2025-01-19 08:04:44Z) 8 months ago (Viewed 161,517 times) Viewed 162k times (This question shows research effort; it is useful and clear) (69:3:31e,16:45b6d716923eccfc,10:1759674535,16:186d1b9457a27d3c,7:4581727,cc7b4e6e15f4905fc330e81ad48babadec427af896d05c48b362da2d2c04ca23) 152 (This question does not show any research effort; it is unclear or not useful) (69:3:31e,16:c5b4e8718b8e9431,10:1759674535,16:6ff977d379d45ec0,7:4581727,d4a99e67c6abf960614a2640d4db68c1d068ffc04d7125ba06f1fb7573993da7) (Save this question.) (https://stackoverflow.com/posts/4581727/timeline) (Show activity on this post.) For development I'm using SQLite database with production in PostgreSQL. I updated my local database with data and need to transfer a specific table to the production database. Running sqlite database .dump > /the/path/to/sqlite-dumpfile.sql , SQLite outputs a table dump in the following format: BEGIN TRANSACTION; CREATE TABLE "courses_school" ("id" integer PRIMARY KEY, "department_count" integer NOT NULL DEFAULT 0, "the_id" integer UNIQUE, "school_name" varchar(150), "slug" varchar(50)); INSERT INTO "courses_school" VALUES(1,168,213,'TEST Name A',NULL); INSERT INTO "courses_school" VALUES(2,0,656,'TEST Name B',NULL); .... COMMIT; How do I convert this into a PostgreSQL compatible dump file I can import into my production server? (https://stackoverflow.com/questions/tagged/postgresql) (show questions tagged 'postgresql') postgresql (https://stackoverflow.com/questions/tagged/sqlite) (show questions tagged 'sqlite') sqlite (https://stackoverflow.com/questions/tagged/migration) (show questions tagged 'migration') migration (https://stackoverflow.com/q/4581727) (Short permalink to this question) Share (https://stackoverflow.com/posts/4581727/edit) () Improve this question (Follow this question to receive notifications) Follow (69:3:31e,16:d454b67f94e157a2,10:1759674535,16:22b881f37a8131aa,7:4581727,4e607ed1eb1d3f5cc42aac3552c6cdb9111e8f41943febac69b7e226f8839490) (https://stackoverflow.com/posts/4581727/revisions) (show all edits to this post) edited (2023-06-20 16:18:25Z) Jun 20, 2023 at 16:18 (https://stackoverflow.com/users/4157124/user4157124) (user4157124's user avatar) (https://stackoverflow.com/users/4157124/user4157124) user4157124 (reputation score) 3,000 (19 gold badges) 19 19 gold badges (32 silver badges) 32 32 silver badges (48 bronze badges) 48 48 bronze badges asked (2011-01-03 02:33:26Z) Jan 3, 2011 at 2:33 (https://stackoverflow.com/users/423277/devx) (DevX's user avatar) (https://stackoverflow.com/users/423277/devx) DevX DevX (reputation score) 1,934 (2 gold badges) 2 2 gold badges (15 silver badges) 15 15 silver badges (17 bronze badges) 17 17 bronze badges 1 (number of 'useful comment' votes received) 6 Well, that command did not work for me until I changed sqlite to sqlite3 Celal Ergün – (https://stackoverflow.com/users/334690/celal-erg%c3%bcn) (995 reputation) Celal Ergün 2018-03-25 19:57:47 +00:00 Commented (2018-03-25 19:57:47Z, License: CC BY-SA 3.0) Mar 25, 2018 at 19:57 (Use comments to ask for more information or suggest improvements. Avoid answering questions in comments.) (how-to-convert-sqlite-sql-dump-file-to-postgresql.html#) Add a comment | (Expand to show all comments on this post) (how-to-convert-sqlite-sql-dump-file-to-postgresql.html#) 8 Answers 8 Sorted by: (https://stackoverflow.com/questions/4581727/how-to-convert-sqlite-sql-dump-file-to-postgresql?answertab=scoredesc#tab-top) Reset to default (scoredesc) Highest score (default) (trending) Trending (recent votes count more) (modifieddesc) Date modified (newest first) (createdasc) Date created (oldest first) (This answer is useful) (69:3:31e,16:f76aa8350c9ec4f2,10:1759674535,16:f22779d3996eb6bd,7:4581921,19d36411fe2e1f979d1a3a9069702544a210ba5f222db8b47eb340723f80cc53) 146 (This answer is not useful) (69:3:31e,16:1a90a99943c86b19,10:1759674535,16:7810a77a1a0ebd4c,7:4581921,a0d1c5527cd03742859405a655471835081ffeef1c1bf3d5a998a58e9842c86c) (Save this answer.) (Loading when this answer was accepted…) (https://stackoverflow.com/posts/4581921/timeline) (Show activity on this post.) You should be able to feed that dump file straight into psql : /path/to/psql -d database -U username -W < /the/path/to/sqlite-dumpfile.sql If you want the id column to "auto increment" then change its type from "int" to "serial" in the table creation line. PostgreSQL will then attach a sequence to that column so that INSERTs with NULL ids will be automatically assigned the next available value. PostgreSQL will also not recognize AUTOINCREMENT commands, so these need to be removed. You'll also want to check for datetime columns in the SQLite schema and change them to timestamp for PostgreSQL. (Thanks to (https://stackoverflow.com/users/373402/clay) Clay for pointing this out.) If you have booleans in your SQLite then you could convert 1 and 0 to 1::boolean and 0::boolean (respectively) or you could change the boolean column to an integer in the schema section of the dump and then fix them up by hand inside PostgreSQL after the import. If you have BLOBs in your SQLite then you'll want to adjust the schema to use bytea . You'll probably need to mix in some (https://stackoverflow.com/a/3103416/479863) decode calls as well . Writing a quick'n'dirty copier in your favorite language might be easier than mangling the SQL if you a lot of BLOBs to deal with though. As usual, if you have foreign keys then you'll probably want to look into (http://www.postgresql.org/docs/current/static/sql-set-constraints.html) set constraints all deferred to avoid insert ordering problems, placing the command inside the BEGIN/COMMIT pair. Thanks to (https://stackoverflow.com/users/6372/nicholas-riley) Nicolas Riley for the boolean, blob, and constraints notes. If you have ` on your code, as generated by some SQLite3 clients, you need to remove them. PostGRESQL also doesn't recognize unsigned columns, so you might want to drop that or add a custom-made constraint such as this: CREATE TABLE tablename ( ... unsigned_column_name integer CHECK (unsigned_column_name > 0) ); While SQLite defaults null values to '' , PostgreSQL requires them to be set as NULL . The syntax in the SQLite dump file appears to be mostly compatible with PostgreSQL so you can patch a few things and feed it to psql . Importing a big pile of data through SQL INSERTs might take a while but it'll work. (https://stackoverflow.com/a/4581921) (Short permalink to this answer) Share (https://stackoverflow.com/posts/4581921/edit) () Improve this answer (Follow this answer to receive notifications) Follow (69:3:31e,16:32113e813eabeeab,10:1759674535,16:09f946c895133677,7:4581921,20767439842bbab7bdd665fd5c3d30ecfb8b63ed7f3c0e81973adc43ae2419a1) (https://stackoverflow.com/posts/4581921/revisions) (show all edits to this post) edited (2020-09-16 02:54:01Z) Sep 16, 2020 at 2:54 (This post is community owned as of Feb 11, 2012 at 5:09. Votes do not generate reputation, and it can be edited by users with 100 rep) community wiki (https://stackoverflow.com/posts/4581921/revisions) (show revision history for this post) 11 revs, 7 users 62%(https://stackoverflow.com/users/479863) mu is too short Sign up to request clarification or add additional context in comments. 11 Comments Add a comment (https://stackoverflow.com/users/98530/peter-eisentraut) () Peter Eisentraut (https://stackoverflow.com/users/98530/peter-eisentraut) Peter Eisentraut (how-to-convert-sqlite-sql-dump-file-to-postgresql.html#comment5032236_4581921) (2011-01-03T07:07:55.353Z) Over a year ago No, you want to keep the transaction to avoid some overhead. 2011-01-03T07:07:55.353Z+00:00 4 Reply Copy link (https://stackoverflow.com/users/899227/r03) () r03 (https://stackoverflow.com/users/899227/r03) r03 (how-to-convert-sqlite-sql-dump-file-to-postgresql.html#comment22097863_4581921) (2013-03-23T10:51:14.93Z) Over a year ago You can use to_timestamp() in the postgreSQL to convert a timestamp to a progreSQL timestamp 2013-03-23T10:51:14.93Z+00:00 2 Reply Copy link (https://stackoverflow.com/users/171965/jeff-hammerbacher) () Jeff Hammerbacher (https://stackoverflow.com/users/171965/jeff-hammerbacher) Jeff Hammerbacher (how-to-convert-sqlite-sql-dump-file-to-postgresql.html#comment39948426_4581921) (2014-08-30T00:30:24.093Z) Over a year ago I'd note that the integer type in Sqlite defaults to 8 bytes, while the integer type in PostgreSQL is 4 bytes. To be safe, you may want to convert your integer -typed columns in Sqlite to the bigint type in PostgreSQL. 2014-08-30T00:30:24.093Z+00:00 1 Reply Copy link (https://stackoverflow.com/users/3211422/saravanabalagi-ramachandran) () Saravanabalagi Ramachandran (https://stackoverflow.com/users/3211422/saravanabalagi-ramachandran) Saravanabalagi Ramachandran (how-to-convert-sqlite-sql-dump-file-to-postgresql.html#comment68056550_4581921) (2016-11-03T13:50:59.463Z) Over a year ago Should remove DELETE FROM sqlite_sequence; and replace INSERT INTO "sqlite_sequence" VALUES('locations',7); with ALTER SEQUENCE locations_id_seq RESTART WITH 8; and it works...! 2016-11-03T13:50:59.463Z+00:00 1 Reply Copy link (https://stackoverflow.com/users/2016181/jan) () Jan (https://stackoverflow.com/users/2016181/jan) Jan (how-to-convert-sqlite-sql-dump-file-to-postgresql.html#comment125573848_4581921) (2022-02-08T14:17:15.953Z) Over a year ago the sqlite3 output has table names with capitals which are quoted in the create table statement, but not in the insert into statements, so inserts fail. Another little gotcha 2022-02-08T14:17:15.953Z+00:00 1 Reply Copy link Add a comment | Show 6 more comments (This answer is useful) (70:3:31e,16:d1038871d68b73f6,10:1759674535,16:f4fde26c89f199a9,8:30544492,741fa5ae3d15ee5a9061a71104fd513c88e30a2ff3ea3a38392b34979cc985ee) 98 (This answer is not useful) (70:3:31e,16:253ab34c53c3340b,10:1759674535,16:c14fec4587e9ceb2,8:30544492,35caa3e8dcf3e674103f36f903e89276f65c8c12ec311ad047b2ebbe912c22ed) (Save this answer.) (Loading when this answer was accepted…) (https://stackoverflow.com/posts/30544492/timeline) (Show activity on this post.) (https://github.com/dimitri/pgloader) pgloader I came across this post when searching for a way to convert an SQLite dump to PostgreSQL. Even though this post has an accepted answer (and a good one at that +1), I think adding this is important. I started looking into the solutions here and realized that I was looking for a more automated method. I looked up the wiki docs: (https://wiki.postgresql.org/wiki/Converting_from_other_Databases_to_PostgreSQL) https://wiki.postgresql.org/wiki/Converting_from_other_Databases_to_PostgreSQL and discovered pgloader . Pretty cool application and it's relatively easy to use. You can convert the flat SQLite file into a usable PostgreSQL database. I installed from the *.deb and created a command file like this in a test directory: load database from 'db.sqlite3' into postgresql:///testdb with include drop, create tables, create indexes, reset sequences set work_mem to '16MB', maintenance_work_mem to '512 MB'; like the (http://pgloader.readthedocs.io/en/latest/tutorial/tutorial.html#loading-sqlite-files-with-pgloader) docs state. I then created a testdb with createdb : createdb testdb I ran the pgloader command like this: pgloader command and then connected to the new database: psql testdb After some queries to check the data, it appears it worked quite well. I know if I had tried to run one of these scripts or do the stepwise conversion mentioned herein, I would have spent much more time. To prove the concept I dumped this testdb and imported into a development environment on a production server and the data transferred over nicely. (https://stackoverflow.com/a/30544492) (Short permalink to this answer) Share (https://stackoverflow.com/posts/30544492/edit) () Improve this answer (Follow this answer to receive notifications) Follow (70:3:31e,16:e5525639a1ab7782,10:1759674535,16:2d578ca5e6b0337c,8:30544492,d6c517961464e958c39eb72272f8d0d14e2184b2a4276e544a6ea2ae67dcec51) (https://stackoverflow.com/posts/30544492/revisions) (show all edits to this post) edited (2020-06-20 09:12:55Z) Jun 20, 2020 at 9:12 (https://stackoverflow.com/users/-1/community) (Community's user avatar) (https://stackoverflow.com/users/-1/community) Community (Community Bot — not a real person. Replies to this bot are not monitored.) Bot (reputation score) 1 (1 silver badge) 1 1 silver badge answered (2015-05-30 09:30:30Z) May 30, 2015 at 9:30 (https://stackoverflow.com/users/311168/nicorellius) (nicorellius's user avatar) (https://stackoverflow.com/users/311168/nicorellius) nicorellius nicorellius (reputation score) 4,143 (5 gold badges) 5 5 gold badges (56 silver badges) 56 56 silver badges (81 bronze badges) 81 81 bronze badges 5 Comments Add a comment (https://stackoverflow.com/users/499698/silpol) () silpol (https://stackoverflow.com/users/499698/silpol) silpol (how-to-convert-sqlite-sql-dump-file-to-postgresql.html#comment62244378_30544492) (2016-05-21T17:03:58.707Z) Over a year ago Beware that (still supported) Ubuntu distributions might have outdated version - v2.x.y are already deprecated and don't actually work. v3.2.x might work but v3.2.3 is recommended. I have fetched v3.2.3 from bleeding edge and installed with sudo dpkg -i <.deb file name> , it had no problem with dependencies. 2016-05-21T17:03:58.707Z+00:00 3 Reply Copy link (https://stackoverflow.com/users/4880924/benkoshy) () BenKoshy (https://stackoverflow.com/users/4880924/benkoshy) BenKoshy (how-to-convert-sqlite-sql-dump-file-to-postgresql.html#comment66853754_30544492) (2016-09-29T20:51:14.913Z) Over a year ago I concur with @silpol - be sure to download the latest stable release and install using your fav package manager; for the "command" file this is just a text file called 'command' with no extension name (i.e. no need for .txt at the end of the file name) you don't need to put the file name in angular brackets; i had to change the search_parth of the psql database in order to see my data; pgloader works well and saved me a great deal of hassle 2016-09-29T20:51:14.913Z+00:00 1 Reply Copy link (https://stackoverflow.com/users/1103863/sveri) () sveri (https://stackoverflow.com/users/1103863/sveri) sveri (how-to-convert-sqlite-sql-dump-file-to-postgresql.html#comment117106888_30544492) (2021-02-17T09:12:52.973Z) Over a year ago Unfortunately it does not work on windows. 2021-02-17T09:12:52.973Z+00:00 0 Reply Copy link (https://stackoverflow.com/users/1774707/user42723) () user42723 (https://stackoverflow.com/users/1774707/user42723) user42723 (how-to-convert-sqlite-sql-dump-file-to-postgresql.html#comment139945958_30544492) (2025-01-15T13:32:58.477Z) Jan 15 at 13:32 (Edited 1 time) Buggy program, it crashes when I tried it, version 3.6.7 (heap exhausted during garbage collection) 2025-01-15T13:32:58.477Z+00:00 0 Reply Copy link (https://stackoverflow.com/users/3845208/alex) () Alex (https://stackoverflow.com/users/3845208/alex) Alex (how-to-convert-sqlite-sql-dump-file-to-postgresql.html#comment140288912_30544492) (2025-04-02T06:19:00.557Z) Apr 2 at 6:19 I strongly recommend exporting your Postgres password as an env var export PGPASSWORD=xxx and then omitting it from the connection string. So just put e.g. into postgresql://user@host:port/database in the pgloader command file 2025-04-02T06:19:00.557Z+00:00 0 Reply Copy link Add a comment (This answer is useful) (70:3:31e,16:7f34d3b9e6241d12,10:1759674535,16:3968c51021e10f84,8:31521432,427b6ab3cba8dd31548b79d7ebec48eae0f77d7403d020a707b397b88a3849da) 35 (This answer is not useful) (70:3:31e,16:4ae424fb1fffff92,10:1759674535,16:794549589b4ca425,8:31521432,41685df8663aa330d1e7fc63dfab1af7208ea845ea5380b936283fbe9a778484) (Save this answer.) (Loading when this answer was accepted…) (https://stackoverflow.com/posts/31521432/timeline) (Show activity on this post.) The (https://github.com/jeremyevans/sequel) sequel gem (a Ruby library) offers data copying across different databases: (http://sequel.jeremyevans.net/rdoc/files/doc/bin_sequel_rdoc.html#label-Copy+Databases) http://sequel.jeremyevans.net/rdoc/files/doc/bin_sequel_rdoc.html#label-Copy+Databases First install Ruby, then install the gem by running gem install sequel . In case of sqlite, it would be like this: sequel -C sqlite://db/production.sqlite3 postgres://user@localhost/db Update: In 2025 one seems to need to install sqlite gem before this can be run. Please consult the (https://github.com/sparklemotion/sqlite3-ruby/blob/main/INSTALLATION.md#avoiding-the-precompiled-native-gem) installation guide . (https://stackoverflow.com/a/31521432) (Short permalink to this answer) Share (https://stackoverflow.com/posts/31521432/edit) () Improve this answer (Follow this answer to receive notifications) Follow (70:3:31e,16:ad9c532a5de6ebe5,10:1759674535,16:ae816888f75ba305,8:31521432,b19de32cb57e7b148dcb73c0f79ba2a5f4ce21ce6e7f55f8a28a82d1fab00ea8) (https://stackoverflow.com/posts/31521432/revisions) (show all edits to this post) edited (2025-01-19 08:04:44Z) Jan 19 at 8:04 answered (2015-07-20 16:16:57Z) Jul 20, 2015 at 16:16 (https://stackoverflow.com/users/474597/lulalala) (lulalala's user avatar) (https://stackoverflow.com/users/474597/lulalala) lulalala lulalala (reputation score 18,030) 18k (15 gold badges) 15 15 gold badges (114 silver badges) 114 114 silver badges (179 bronze badges) 179 179 bronze badges 12 Comments Add a comment (https://stackoverflow.com/users/2976251/hasufell) () hasufell (https://stackoverflow.com/users/2976251/hasufell) hasufell (how-to-convert-sqlite-sql-dump-file-to-postgresql.html#comment103584779_31521432) (2019-10-31T08:39:19.95Z) Over a year ago Absolutely, pgloader is messy, the GC seems to crash on huge databases: (https://github.com/dimitri/pgloader/issues/962) github.com/dimitri/pgloader/issues/962 2019-10-31T08:39:19.95Z+00:00 3 Reply Copy link (https://stackoverflow.com/users/1680728/felix) () Felix (https://stackoverflow.com/users/1680728/felix) Felix (how-to-convert-sqlite-sql-dump-file-to-postgresql.html#comment113565292_31521432) (2020-10-06T08:38:10.4Z) Over a year ago Feel free to post your answer at (https://stackoverflow.com/questions/6148421/how-to-convert-a-postgres-database-to-sqlite/64222183#64222183) (how to convert a postgres database to sqlite) stackoverflow.com/questions/6148421/… where I copied your answer. Then ping me and I will revoke my answer if you want the reps for it. 2020-10-06T08:38:10.4Z+00:00 0 Reply Copy link (https://stackoverflow.com/users/1774707/user42723) () user42723 (https://stackoverflow.com/users/1774707/user42723) user42723 (how-to-convert-sqlite-sql-dump-file-to-postgresql.html#comment139946011_31521432) (2025-01-15T13:43:16.547Z) Jan 15 at 13:43 (Edited 1 time) Doesn't work when I try it: Error: Sequel::AdapterNotFound: LoadError: cannot load such file -- sqlite3 2025-01-15T13:43:16.547Z+00:00 0 Reply Copy link (https://stackoverflow.com/users/474597/lulalala) () lulalala (https://stackoverflow.com/users/474597/lulalala) lulalala (how-to-convert-sqlite-sql-dump-file-to-postgresql.html#comment139950383_31521432) (2025-01-16T07:35:09.677Z) Jan 16 at 7:35 @user42723 Can you try running gem install sqlite3 ? 2025-01-16T07:35:09.677Z+00:00 0 Reply Copy link (https://stackoverflow.com/users/1774707/user42723) () user42723 (https://stackoverflow.com/users/1774707/user42723) user42723 (how-to-convert-sqlite-sql-dump-file-to-postgresql.html#comment139952028_31521432) (2025-01-16T12:46:59.507Z) Jan 16 at 12:46 (Edited 1 time) @lulalala I tried that already, "ERROR: Failed to build gem native extension." The easiest for me was to just write some code with SELECT and INSERT queries. 2025-01-16T12:46:59.507Z+00:00 0 Reply Copy link Add a comment | Show 7 more comments (This answer is useful) (70:3:31e,16:9f22794ec1328893,10:1759674535,16:adb5f5bfce2bf2e5,8:25924065,6ab60dd9bdd5b01220ad0fc20f7fd752bdddda75f58fe92669c80c6628953c52) 26 (This answer is not useful) (70:3:31e,16:3341c22f913b0f83,10:1759674535,16:b7c8b4e9b403a69e,8:25924065,728348435c3090d597e5af718de11c3eb575c37138b94fbbbcb1191c617ef0ba) (Save this answer.) (Loading when this answer was accepted…) (https://stackoverflow.com/posts/25924065/timeline) (Show activity on this post.) You can use a one liner, here is an example with the help of sed command: sqlite3 mjsqlite.db .dump | sed -e 's/INTEGER PRIMARY KEY AUTOINCREMENT/SERIAL PRIMARY KEY/g;s/PRAGMA foreign_keys=OFF;//;s/unsigned big int/BIGINT/g;s/UNSIGNED BIG INT/BIGINT/g;s/BIG INT/BIGINT/g;s/UNSIGNED INT(10)/BIGINT/g;s/BOOLEAN/SMALLINT/g;s/boolean/SMALLINT/g;s/UNSIGNED BIG INT/INTEGER/g;s/INT(3)/INT2/g;s/DATETIME/TIMESTAMP/g' | psql mypqdb mypguser (https://stackoverflow.com/a/25924065) (Short permalink to this answer) Share (https://stackoverflow.com/posts/25924065/edit) () Improve this answer (Follow this answer to receive notifications) Follow (70:3:31e,16:cc348fadd4992d9d,10:1759674535,16:ee25e1c48e7ee059,8:25924065,fefcbe16fc35b9784a7828de22a0efa43271869ad926316ca4b482df4b40adf0) (https://stackoverflow.com/posts/25924065/revisions) (show all edits to this post) edited (2022-03-02 06:57:40Z) Mar 2, 2022 at 6:57 answered (2014-09-18 23:30:50Z) Sep 18, 2014 at 23:30 (https://stackoverflow.com/users/2108644/develcuy) (develCuy's user avatar) (https://stackoverflow.com/users/2108644/develcuy) develCuy develCuy (reputation score) 655 (7 silver badges) 7 7 silver badges (14 bronze badges) 14 14 bronze badges 7 Comments Add a comment (https://stackoverflow.com/users/365675/yetanothercoder) () yetanothercoder (https://stackoverflow.com/users/365675/yetanothercoder) yetanothercoder (how-to-convert-sqlite-sql-dump-file-to-postgresql.html#comment50706119_25924065) (2015-07-11T23:12:42.34Z) Over a year ago there is no replace for LONG type, e.g. 2015-07-11T23:12:42.34Z+00:00 0 Reply Copy link (https://stackoverflow.com/users/499698/silpol) () silpol (https://stackoverflow.com/users/499698/silpol) silpol (how-to-convert-sqlite-sql-dump-file-to-postgresql.html#comment62100917_25924065) (2016-05-17T23:53:59.417Z) Over a year ago (Edited 4 times) one more item could be added sed -e 's/DATETIME/TIMESTAMP/g' 2016-05-17T23:53:59.417Z+00:00 2 Reply Copy link (https://stackoverflow.com/users/441960/purplejacket) () Purplejacket (https://stackoverflow.com/users/441960/purplejacket) Purplejacket (how-to-convert-sqlite-sql-dump-file-to-postgresql.html#comment76607272_25924065) (2017-06-28T22:07:39.957Z) Over a year ago (Edited 2 times) sed -e 's/TINYINT(1)/SMALLINT/g' -- and for a comparison of all the data types see (https://stackoverflow.com/questions/1942586/comparison-of-database-column-types-in-mysql-postgresql-and-sqlite-cross-map) (comparison of database column types in mysql postgresql and sqlite cross map) stackoverflow.com/questions/1942586/… 2017-06-28T22:07:39.957Z+00:00 2 Reply Copy link (https://stackoverflow.com/users/247542/cerin) () Cerin (https://stackoverflow.com/users/247542/cerin) Cerin (how-to-convert-sqlite-sql-dump-file-to-postgresql.html#comment95782695_25924065) (2019-02-01T22:41:47.9Z) Over a year ago This doesn't work. I get the error ERROR: syntax error at or near "AUTOINCREMENT" 2019-02-01T22:41:47.9Z+00:00 0 Reply Copy link (https://stackoverflow.com/users/2733113/astraserg) () AstraSerg (https://stackoverflow.com/users/2733113/astraserg) AstraSerg (how-to-convert-sqlite-sql-dump-file-to-postgresql.html#comment104530420_25924065) (2019-12-03T08:32:19.383Z) Over a year ago Replace ' | sed -e ' with ; :) 2019-12-03T08:32:19.383Z+00:00 2 Reply Copy link Add a comment | Show 2 more comments (This answer is useful) (70:3:31e,16:c1928b9a6a179de2,10:1759674535,16:397602d5b2d77530,8:64960007,be5c94ad5d32f5a27079450f5a65c03b601e71224b73cb7535efa8e6f08ed5ab) 9 (This answer is not useful) (70:3:31e,16:3217da437fefe39f,10:1759674535,16:4c92d48ecc98ed8c,8:64960007,90ffddf9d574c036a0d2677a3bc8b7e8f83147d668fa7a7117609dbd60e23e8e) (Save this answer.) (Loading when this answer was accepted…) (https://stackoverflow.com/posts/64960007/timeline) (Show activity on this post.) Dump SQLite database to JSON: python3 manage.py dumpdata > data.json Change connection from SQLite to PostgreSQL. Create tables without migration: python3 manage.py migrate --run-syncdb Open Django shell, then exclude ContentType data: python3 manage.py shell from django.contrib.contenttypes.models import ContentType ContentType.objects.all().delete() quit() Load data: python3 manage.py loaddata data.json (https://stackoverflow.com/a/64960007) (Short permalink to this answer) Share (https://stackoverflow.com/posts/64960007/edit) () Improve this answer (Follow this answer to receive notifications) Follow (70:3:31e,16:e1a559f049ab0c50,10:1759674535,16:96c22df2b306d101,8:64960007,a260856a6814c10a94daab9e4ba117a3248482b8aed7b7a44ed9b5a40f441ba5) (https://stackoverflow.com/posts/64960007/revisions) (show all edits to this post) edited (2024-09-29 03:42:29Z) Sep 29, 2024 at 3:42 (https://stackoverflow.com/users/4157124/user4157124) (user4157124's user avatar) (https://stackoverflow.com/users/4157124/user4157124) user4157124 (reputation score) 3,000 (19 gold badges) 19 19 gold badges (32 silver badges) 32 32 silver badges (48 bronze badges) 48 48 bronze badges answered (2020-11-22 21:54:58Z) Nov 22, 2020 at 21:54 (https://stackoverflow.com/users/11021308/kusal-thiwanka) (Kusal Thiwanka's user avatar) (https://stackoverflow.com/users/11021308/kusal-thiwanka) Kusal Thiwanka Kusal Thiwanka (reputation score) 339 (3 silver badges) 3 3 silver badges (5 bronze badges) 5 5 bronze badges 4 Comments Add a comment (https://stackoverflow.com/users/8023932/givejob) () giveJob (https://stackoverflow.com/users/8023932/givejob) giveJob (how-to-convert-sqlite-sql-dump-file-to-postgresql.html#comment115205552_64960007) (2020-12-06T05:51:00.65Z) Over a year ago for large GB JSON files huge ram required 2020-12-06T05:51:00.65Z+00:00 1 Reply Copy link (https://stackoverflow.com/users/9817043/valheruborn) () ValheruBorn (https://stackoverflow.com/users/9817043/valheruborn) ValheruBorn (how-to-convert-sqlite-sql-dump-file-to-postgresql.html#comment137298416_64960007) (2024-01-25T14:03:25.85Z) Over a year ago Thanks a million for this. Why should content types be excluded? 2024-01-25T14:03:25.85Z+00:00 0 Reply Copy link (https://stackoverflow.com/users/4813038/jessieinag) () JessieinAg (https://stackoverflow.com/users/4813038/jessieinag) JessieinAg (how-to-convert-sqlite-sql-dump-file-to-postgresql.html#comment139964383_64960007) (2025-01-18T21:52:44.19Z) Jan 18 at 21:52 Thank you so much! This is the perfect solution for Django projects. 2025-01-18T21:52:44.19Z+00:00 0 Reply Copy link (https://stackoverflow.com/users/674976/texnic) () texnic (https://stackoverflow.com/users/674976/texnic) texnic (how-to-convert-sqlite-sql-dump-file-to-postgresql.html#comment140457329_64960007) (2025-05-25T15:45:32.073Z) May 25 at 15:45 Insteaf of > data.json , one should use -o data.json . Otherwise cannot import back (dumping adds a text line infront of JSON). 2025-05-25T15:45:32.073Z+00:00 0 Reply Copy link Add a comment (This answer is useful) (70:3:31e,16:3913d11fa566897f,10:1759674535,16:2b491032e289f857,8:52174532,cc2c667ab472dad18f43bbc300a4609577c4a791d153d05c7bead6a7b36e5b08) 2 (This answer is not useful) (70:3:31e,16:da065141bf224f39,10:1759674535,16:ffb569d22b064513,8:52174532,56e0a89ded169d4e7f13df11ce14f505f9a1a204129f53102adecfcdbcee62e5) (Save this answer.) (Loading when this answer was accepted…) (https://stackoverflow.com/posts/52174532/timeline) (Show activity on this post.) pgloader work wonders on converting database in sqlite to postgresql. Here's an example on converting a local sqlitedb to a remote PostgreSQL db: pgloader sqlite.db postgresql://username :password @hostname /dbname (https://stackoverflow.com/a/52174532) (Short permalink to this answer) Share (https://stackoverflow.com/posts/52174532/edit) () Improve this answer (Follow this answer to receive notifications) Follow (70:3:31e,16:f3f07b8df52777b5,10:1759674535,16:c11f1e7ea45815f8,8:52174532,8fd6b441424de0d2d7fd95442eada1fead0aa1ef6c7d5f5d56cdaec99a00360f) answered (2018-09-04 22:00:30Z) Sep 4, 2018 at 22:00 (https://stackoverflow.com/users/9849361/kouichi) (kouichi's user avatar) (https://stackoverflow.com/users/9849361/kouichi) kouichi kouichi (reputation score) 106 (8 bronze badges) 8 8 bronze badges 1 Comment Add a comment (https://stackoverflow.com/users/247542/cerin) () Cerin (https://stackoverflow.com/users/247542/cerin) Cerin (how-to-convert-sqlite-sql-dump-file-to-postgresql.html#comment95782734_52174532) (2019-02-01T22:43:56.313Z) Over a year ago Pgloader is terribly buggy and unreliable. It immediately crashes with the error KABOOM! Control stack exhausted (no more space for function call frames). 2019-02-01T22:43:56.313Z+00:00 3 Reply Copy link (This answer is useful) (70:3:31e,16:1743fba3a5c2be66,10:1759674535,16:6450e63bb82c79a8,8:56034676,f8f848ed5a8462238306c57d99318aca6a8b34b1bdbb941c00f605fbc5068415) 1 (This answer is not useful) (70:3:31e,16:5763ff79390e6af2,10:1759674535,16:b7f55d460a2e47b4,8:56034676,72e6cafff2b7da6fbe4a73332501b4351d8b41e6f6aae90c1b3c5450abc4948e) (Save this answer.) (Loading when this answer was accepted…) (https://stackoverflow.com/posts/56034676/timeline) (Show activity on this post.) I have tried editing/regexping the sqlite dump so PostgreSQL accepts it, it is tedious and prone to error. What I got to work really fast: First recreate the schema on PostgreSQL without any data, either editing the dump or if you were using an ORM you may be lucky and it talks to both back-ends (sqlalchemy, peewee, ...). Then migrate the data using pandas. Suppose you have a table with a bool field (which is 0/1 in sqlite, but must be t/f in PostgreSQL) def int_to_strbool(df, column): df = df.replace({column: 0}, 'f') df = df.replace({column: 1}, 't') return df #def other_transform(df, column): #... conn = sqlite3.connect(db) df = pd.read_sql(f'select * from {table_name}', conn) df = int_to_strbool(df, bool_column_name) #df = other_transform(df, other_column_name) df.to_csv(table_name + '.csv'), sep=',', header=False, index=False) This works like a charm, is easy to write, read and debug each function, unlike (for me) the regular expressions. Now you can try to load the resulting csv with PostgreSQL (even graphically with the admin tool), with the only caveat that you must load the tables with foreign keys after you have loaded the tables with the corresponding source keys. I did not have the case of a circular dependency, I guess you can suspend temporarily the key checking if that is the case. (https://stackoverflow.com/a/56034676) (Short permalink to this answer) Share (https://stackoverflow.com/posts/56034676/edit) () Improve this answer (Follow this answer to receive notifications) Follow (70:3:31e,16:65ce1c1e62a83bdd,10:1759674535,16:92cb9f4b8a84d7c0,8:56034676,baa3f3a453aa79c22a149819b094a18030485e99c348e9a75aa20e7b8b97262b) answered (2019-05-08 06:22:18Z) May 8, 2019 at 6:22 (https://stackoverflow.com/users/3782422/agomcas) (agomcas's user avatar) (https://stackoverflow.com/users/3782422/agomcas) agomcas agomcas (reputation score) 705 (5 silver badges) 5 5 silver badges (12 bronze badges) 12 12 bronze badges Comments Add a comment (This answer is useful) (70:3:31e,16:659bd56e56207614,10:1759674535,16:0a0fe17f5e6f4cb4,8:78377603,af647f580d9a19244a00a685fbd4a024b680899174448efdf534d93ee6db5b3d) 0 (This answer is not useful) (70:3:31e,16:e4892f9714b601b7,10:1759674535,16:05091bc59c1c7b0c,8:78377603,7bd39294e42e0cd399df8ca07dde432c99b1c44cf0b834fff7dafe378b6f16de) (Save this answer.) (Loading when this answer was accepted…) (https://stackoverflow.com/posts/78377603/timeline) (Show activity on this post.) install pgloader : sudo apt-get install pgloader then: pgloader sqlite:///path/to/sqlite/database.sqlite postgresql://username:password@hostname:port/databasename that's it! (https://stackoverflow.com/a/78377603) (Short permalink to this answer) Share (https://stackoverflow.com/posts/78377603/edit) () Improve this answer (Follow this answer to receive notifications) Follow (70:3:31e,16:cd747eef17a584fe,10:1759674535,16:82cc5a0706b59921,8:78377603,68eafb716fa895dd6a148e8e69452ec7be50ed16406fe3d18edbebb621a631e0) answered (2024-04-24 10:09:13Z) Apr 24, 2024 at 10:09 (https://stackoverflow.com/users/10143045/mohammad-amin-eskandari) (Mohammad Amin Eskandari's user avatar) (https://stackoverflow.com/users/10143045/mohammad-amin-eskandari) Mohammad Amin Eskandari Mohammad Amin Eskandari (reputation score) 384 (5 silver badges) 5 5 silver badges (8 bronze badges) 8 8 bronze badges Comments Add a comment (4581727) (false) () (0) Your Answer (True) (how-to-convert-sqlite-sql-dump-file-to-postgresql.html#) Thanks for contributing an answer to Stack Overflow! Please be sure to answer the question . Provide details and share your research! But avoid … Asking for help, clarification, or responding to other answers. Making statements based on opinion; back them up with references or personal experience. To learn more, see our (https://stackoverflow.com/help/how-to-answer) tips on writing great answers . Draft saved Draft discarded (16a63166755f4bdd4f6a5c8fb8c4468cb19872abe0d4f9ac7bdb9620ffd88fbd) Sign up or (https://stackoverflow.com/users/login?ssrc=question_page&returnurl=https%3a%2f%2fstackoverflow.com%2fquestions%2f4581727%2fhow-to-convert-sqlite-sql-dump-file-to-postgresql%23new-answer) log in Sign up using Google Sign up using Email and Password (false) (false) Submit Post as a guest Name () () Email Required, but never shown () () Post as a guest Name () () Email Required, but never shown () () Post Your Answer Discard By clicking “Post Your Answer”, you agree to our (https://stackoverflow.com/legal/terms-of-service/public) terms of service and acknowledge you have read our (https://stackoverflow.com/legal/privacy-policy) privacy policy .(1) Start asking to get answers Find the answer to your question by asking. (https://stackoverflow.com/questions/ask) Ask question Explore related questions (https://stackoverflow.com/questions/tagged/postgresql) (show questions tagged 'postgresql') postgresql (https://stackoverflow.com/questions/tagged/sqlite) (show questions tagged 'sqlite') sqlite (https://stackoverflow.com/questions/tagged/migration) (show questions tagged 'migration') migration See similar questions with these tags. The Overflow Blog (https://stackoverflow.blog/2025/10/03/one-is-not-the-loneliest-number-for-api-calls/) One is not the loneliest number for API calls Featured on Meta (Meta Stack Exchange) (https://meta.stackexchange.com/questions/412667/spevacus-has-joined-us-as-a-community-manager) Spevacus has joined us as a Community Manager (Meta Stack Exchange) (https://meta.stackexchange.com/questions/412705/introducing-a-new-proactive-anti-spam-measure) Introducing a new proactive anti-spam measure (Meta Stack Overflow) (https://meta.stackoverflow.com/questions/421831/policy-generative-ai-e-g-chatgpt-is-banned) Policy: Generative AI (e.g., ChatGPT) is banned (Meta Stack Overflow) (https://meta.stackoverflow.com/questions/435121/exploring-new-types-of-questions-on-stack-overflow) Exploring new types of questions on Stack Overflow Linked (https://stackoverflow.com/questions/3103242/inserting-text-string-with-hex-into-postgresql-as-a-bytea) (Question score (upvotes - downvotes)) 73 (https://stackoverflow.com/questions/3103242/inserting-text-string-with-hex-into-postgresql-as-a-bytea?noredirect=1) Inserting text string with hex into PostgreSQL as a bytea (https://stackoverflow.com/questions/6148421/how-to-convert-a-postgres-database-to-sqlite) (Question score (upvotes - downvotes)) 40 (https://stackoverflow.com/questions/6148421/how-to-convert-a-postgres-database-to-sqlite?noredirect=1) How to convert a postgres database to SQLite? (https://stackoverflow.com/questions/7002194/how-to-copy-database-in-use-to-other-database-in-django) (Question score (upvotes - downvotes)) 22 (https://stackoverflow.com/questions/7002194/how-to-copy-database-in-use-to-other-database-in-django?noredirect=1) How to copy database in use to other database in django? (https://stackoverflow.com/questions/1942586/comparison-of-database-column-types-in-mysql-postgresql-and-sqlite-cross-map) (Question score (upvotes - downvotes)) 101 (https://stackoverflow.com/questions/1942586/comparison-of-database-column-types-in-mysql-postgresql-and-sqlite-cross-map?noredirect=1) Comparison of database column types in MySQL, PostgreSQL, and SQLite? (Cross-Mapping) (https://stackoverflow.com/questions/4248072/how-to-migrate-from-sqlite-to-postgresql-rails) (Question score (upvotes - downvotes)) 18 (https://stackoverflow.com/questions/4248072/how-to-migrate-from-sqlite-to-postgresql-rails?noredirect=1) How to migrate from SQLite to PostgreSQL (Rails) (https://stackoverflow.com/questions/6204142/how-to-convert-sqlite3-script-into-script-that-postgresql-can-understand) (Question score (upvotes - downvotes)) 4 (https://stackoverflow.com/questions/6204142/how-to-convert-sqlite3-script-into-script-that-postgresql-can-understand?noredirect=1) How to convert SQLite3 script into script that PostgreSQL can understand? (https://stackoverflow.com/questions/37388240/database-migrations-to-heroku-dont-work) (Question score (upvotes - downvotes)) 5 (https://stackoverflow.com/questions/37388240/database-migrations-to-heroku-dont-work?noredirect=1) Database migrations to heroku don't work (https://stackoverflow.com/questions/54049328/how-to-open-sqlite-db-in-postgresql) (Question score (upvotes - downvotes)) 4 (https://stackoverflow.com/questions/54049328/how-to-open-sqlite-db-in-postgresql?noredirect=1) how to open SQLite DB in Postgresql (https://stackoverflow.com/questions/68318573/is-there-an-alternative-way-to-import-data-into-postgres-than-using-psql) (Question score (upvotes - downvotes)) 0 (https://stackoverflow.com/questions/68318573/is-there-an-alternative-way-to-import-data-into-postgres-than-using-psql?noredirect=1) Is there an alternative way to import data into Postgres than using psql? (https://stackoverflow.com/questions/48820336/transform-flask-with-sqlite-to-flask-with-postgres) (Question score (upvotes - downvotes)) 2 (https://stackoverflow.com/questions/48820336/transform-flask-with-sqlite-to-flask-with-postgres?noredirect=1) Transform flask with sqlite to Flask with postgres (https://stackoverflow.com/questions/linked/4581727) See more linked questions Related (https://stackoverflow.com/questions/6148421/how-to-convert-a-postgres-database-to-sqlite) (Question score (upvotes - downvotes)) 40 (https://stackoverflow.com/questions/6148421/how-to-convert-a-postgres-database-to-sqlite) How to convert a postgres database to SQLite? (https://stackoverflow.com/questions/6842393/import-sql-dump-into-postgresql-database) (Question score (upvotes - downvotes)) 735 (https://stackoverflow.com/questions/6842393/import-sql-dump-into-postgresql-database) Import SQL dump into PostgreSQL database (https://stackoverflow.com/questions/7365120/converting-sqlite-to-postgres) (Question score (upvotes - downvotes)) 1 (https://stackoverflow.com/questions/7365120/converting-sqlite-to-postgres) converting sqlite to postgres (https://stackoverflow.com/questions/9030990/dump-file-from-sqlite3-to-postgresql-why-do-i-always-get-errors-when-import-it) (Question score (upvotes - downvotes)) 1 (https://stackoverflow.com/questions/9030990/dump-file-from-sqlite3-to-postgresql-why-do-i-always-get-errors-when-import-it) Dump file from Sqlite3 to PostgreSQL: why do I always get errors when import it? (https://stackoverflow.com/questions/9224165/how-can-i-convert-a-postgres-database-to-sqlite-db-with-a-unix-friendly-tool) (Question score (upvotes - downvotes)) 0 (https://stackoverflow.com/questions/9224165/how-can-i-convert-a-postgres-database-to-sqlite-db-with-a-unix-friendly-tool) How can I convert a Postgres database to sqlite DB with a unix friendly tool? (https://stackoverflow.com/questions/18479183/import-pg-dump-into-sqlite3) (Question score (upvotes - downvotes)) 1 (https://stackoverflow.com/questions/18479183/import-pg-dump-into-sqlite3) Import PG Dump Into Sqlite3 (https://stackoverflow.com/questions/36756805/migrate-from-sqlite-to-postgresql) (Question score (upvotes - downvotes)) 1 (https://stackoverflow.com/questions/36756805/migrate-from-sqlite-to-postgresql) Migrate from sqlite to postgresql (https://stackoverflow.com/questions/68319748/is-there-an-easy-way-to-migrate-database-data-from-sqlite-to-postgres-table-by-t) (Question score (upvotes - downvotes)) 3 (https://stackoverflow.com/questions/68319748/is-there-an-easy-way-to-migrate-database-data-from-sqlite-to-postgres-table-by-t) Is there an easy way to migrate database data from SQLite to Postgres table by table in Python? (https://stackoverflow.com/questions/68348389/django-sqlite-to-postgres-database-migration) (Question score (upvotes - downvotes)) 1 (https://stackoverflow.com/questions/68348389/django-sqlite-to-postgres-database-migration) Django sqlite to postgres database migration (https://stackoverflow.com/questions/69089754/trying-to-move-database-form-sqlite3-to-postgresql) (Question score (upvotes - downvotes)) 0 (https://stackoverflow.com/questions/69089754/trying-to-move-database-form-sqlite3-to-postgresql) trying to move database form Sqlite3 to postgresql (https://stackexchange.com/questions?tab=hot) Hot Network Questions (Role-playing Games Stack Exchange) (https://rpg.stackexchange.com/questions/216728/what-attributes-and-skills-are-most-common-in-rpg-systems) What attributes and skills are most common in RPG systems? (Electrical Engineering Stack Exchange) (https://electronics.stackexchange.com/questions/756497/can-a-22pf-capacitor-kill-you) Can a 22pF capacitor kill you (Ask Ubuntu) (https://askubuntu.com/questions/1556907/netcat-does-not-give-error-when-trying-on-listen-on-same-port-twice) netcat does not give error when trying on listen on same port twice (Role-playing Games Stack Exchange) (https://rpg.stackexchange.com/questions/216735/how-to-start-a-campaign-with-the-pcs-exiting-a-stasis-effect) How to start a campaign with the PCs exiting a stasis effect? (Travel Stack Exchange) (https://travel.stackexchange.com/questions/200363/how-to-prepare-my-belongings-in-bali-to-store-them-for-a-few-months) How to prepare my belongings in Bali to store them for a few months? (Role-playing Games Stack Exchange) (https://rpg.stackexchange.com/questions/216727/can-the-effect-of-conjure-animals-move-through-occupied-spaces) Can the effect of Conjure Animals move through occupied spaces? (Software Engineering Stack Exchange) (https://softwareengineering.stackexchange.com/questions/459257/in-an-enterprise-software-team-is-it-recommended-for-developers-to-maintain-a-b) In an enterprise software team, is it recommended for developers to maintain a business knowledge wiki to understand domain concepts and processes? (Home Improvement Stack Exchange) (https://diy.stackexchange.com/questions/323368/cinderblocks-missing-in-two-corners-of-my-house) Cinderblocks missing in two corners of my house (Philosophy Stack Exchange) (https://philosophy.stackexchange.com/questions/130936/how-do-we-know-almost-all-of-math-can-be-interpreted-in-set-theory) How do we know (almost) all of math can be interpreted in set theory? (Politics Stack Exchange) (https://politics.stackexchange.com/questions/93676/why-will-the-government-have-to-lay-people-off-if-the-government-shutdown-contin) Why will the government have to lay people off if the government shutdown continues? (Puzzling Stack Exchange) (https://puzzling.stackexchange.com/questions/133441/nobody-wins-unless-you-do) Nobody wins - unless you do (Cross Validated) (https://stats.stackexchange.com/questions/670590/delta-method-measurbility-question) Delta method measurbility question (German Language Stack Exchange) (https://german.stackexchange.com/questions/80754/what-is-the-german-word-for-dashboard-in-web-context) What is the German word for "Dashboard" in web context? (Cross Validated) (https://stats.stackexchange.com/questions/670554/why-can-a-model-with-higher-mse-still-have-a-higher-r%c2%b2-than-another-model) Why can a model with higher MSE still have a higher R² than another model (Blender Stack Exchange) (https://blender.stackexchange.com/questions/339345/how-to-align-phones-in-a-sphere-in-blender-geo-nodes) How to align "phones" in a sphere in blender geo nodes (Latin Language Stack Exchange) (https://latin.stackexchange.com/questions/25916/why-is-ipse-not-changing-case-in-presence-of-possessive-adjective) Why is ipse not changing case in presence of possessive adjective? (Arqade) (https://gaming.stackexchange.com/questions/413592/what-does-resisted-mean) What does "resisted" mean? (Arqade) (https://gaming.stackexchange.com/questions/413583/what-do-these-person-icons-that-appear-on-steam-games-on-hover-mean) What do these person icons that appear on Steam games on-hover mean? (Electrical Engineering Stack Exchange) (https://electronics.stackexchange.com/questions/756421/output-impedance-of-a-simple-bjt-current-source) Output impedance of a simple BJT current source (Philosophy Stack Exchange) (https://philosophy.stackexchange.com/questions/130944/does-time-flow) Does time flow? (Retrocomputing Stack Exchange) (https://retrocomputing.stackexchange.com/questions/32120/where-does-the-unix-pack-compressor-come-from) Where does the Unix pack compressor come from? (Super User) (https://superuser.com/questions/1926130/why-has-google-authenticator-chrome-extension-suddenly-lost-all-accounts-how-to) Why has Google Authenticator Chrome extension suddenly lost all accounts? How to recover? (Bicycles Stack Exchange) (https://bicycles.stackexchange.com/questions/97568/how-to-prevent-rubbing-from-bicycle-seat) How to prevent rubbing from bicycle seat? (TeX - LaTeX Stack Exchange) (https://tex.stackexchange.com/questions/752017/pgfmathparse-not-working-inside-tikzpicture-environment) \pgfmathparse not working inside tikzpicture environment (how-to-convert-sqlite-sql-dump-file-to-postgresql.html#) more hot questions (https://stackoverflow.com/feeds/question/4581727) (Feed of this question and its answers) Question feed Subscribe to RSS Question feed To subscribe to this RSS feed, copy and paste this URL into your RSS reader. (https://stackoverflow.com/feeds/question/4581727) (how-to-convert-sqlite-sql-dump-file-to-postgresql.html#) () lang-sql (https://stackoverflow.com) (https://stackoverflow.com) Stack Overflow (https://stackoverflow.com/questions) Questions (https://stackoverflow.com/help) Help (https://chat.stackoverflow.com/?tab=explore) Chat (https://stackoverflow.co/) Products (https://stackoverflow.co/teams/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=footer&utm_content=teams) Teams (https://stackoverflow.co/advertising/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=footer&utm_content=advertising) Advertising (https://stackoverflow.co/advertising/employer-branding/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=footer&utm_content=talent) Talent (https://stackoverflow.co/) Company (https://stackoverflow.co/) About (https://stackoverflow.co/company/press/) Press (https://stackoverflow.co/company/work-here/) Work Here (https://stackoverflow.com/legal) Legal (https://stackoverflow.com/legal/privacy-policy) Privacy Policy (https://stackoverflow.com/legal/terms-of-service/public) Terms of Service (https://stackoverflow.com/contact) Contact Us Your Privacy Choices (https://policies.stackoverflow.co/stack-overflow/cookie-policy) Cookie Policy (https://stackexchange.com) Stack Exchange Network (https://stackexchange.com/sites#technology) Technology (https://stackexchange.com/sites#culturerecreation) Culture & recreation (https://stackexchange.com/sites#lifearts) Life & arts (https://stackexchange.com/sites#science) Science (https://stackexchange.com/sites#professional) Professional (https://stackexchange.com/sites#business) Business (https://api.stackexchange.com/) API (https://data.stackexchange.com/) Data (https://stackoverflow.blog?blb=1) Blog (https://www.facebook.com/officialstackoverflow/) Facebook (https://twitter.com/stackoverflow) Twitter (https://linkedin.com/company/stack-overflow) LinkedIn (https://www.instagram.com/thestackoverflow) Instagram Site design / logo © 2025 Stack Exchange Inc; user contributions licensed under (https://stackoverflow.com/help/licensing) CC BY-SA . rev 2025.10.2.34811