How to convert a postgres database to sqlite(如何将 postgres 数据库转换为 sqlite)
问题描述
我们正在开发一个网站,当我们在本地开发时(其中一个来自 Windows),我们使用 sqlite3,但在服务器(linux)上我们使用 postgres.我们希望能够将生产数据库导入到我们的开发过程中,所以我想知道是否有一种方法可以将 postgres 数据库转储转换为 sqlite3 可以理解的东西(只是将 postgres 的转储 SQL 提供给它很多,许多错误).或者只是在 Windows 上安装 postgres 会更容易吗?谢谢.
尽管这里有很多非常有用的答案,但我只想将其标记为已回答.我们最终接受了评论的建议:
<块引用>我只是将您的开发环境切换到 PostgreSQL,在一个数据库之上开发(尤其是像 SQLite 那样松散和宽容的数据库),但部署在另一个数据库上(尤其是像 PostgreSQL 这样严格的数据库)通常是一种加重和咒骂的方法.——@mu 太短了
<块引用>
为了回应 mu 的回应,不要这样做..不要这样做..不要这样做.在同一件事上开发和部署.否则是糟糕的工程实践.– @Kuberchaun
所以我们刚刚在我们的开发机器上安装了 postgres.上手很容易,工作也很顺利.
We're working on a website, and when we develop locally (one of us from Windows), we use sqlite3, but on the server (linux) we use postgres. We'd like to be able to import the production database into our development process, so I'm wondering if there is a way to convert from a postgres database dump to something sqlite3 can understand (just feeding it the postgres's dumped SQL gave many, many errors). Or would it be easier just to install postgres on windows? Thanks.
Even though there are many very good helpful answers here, I just want to mark this as answered. We ended up going with the advice of the comments:
I'd just switch your development environment to PostgreSQL, developing on top of one database (especially one as loose and forgiving as SQLite) but deploying on another (especially one as strict as PostgreSQL) is generally a recipe for aggravation and swearing. – @mu is too short
To echo mu's response, DON'T DO THIS..DON'T DO THIS..DON'T DO THIS. Develop and deploy on the same thing. It's bad engineering practice to do otherwise. – @Kuberchaun
So we just installed postgres on our dev machines. It was easy to get going and worked very smoothly.
这篇关于如何将 postgres 数据库转换为 sqlite的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何将 postgres 数据库转换为 sqlite


- 如何将 SonarQube 6.7 从 MySQL 迁移到 postgresql 2022-01-01
- 使用 Oracle PL/SQL developer 生成测试数据 2021-01-01
- 如何将 Byte[] 插入 SQL Server VARBINARY 列 2021-01-01
- 如何使用 pip 安装 Python MySQLdb 模块? 2021-01-01
- 远程 mySQL 连接抛出“无法使用旧的不安全身份验证连接到 MySQL 4.1+"来自 XAMPP 的错误 2022-01-01
- 以一个值为轴心,但将一行上的数据按另一行分组? 2022-01-01
- 在SQL中,如何为每个组选择前2行 2021-01-01
- 导入具有可变标题的 Excel 文件 2021-01-01
- SQL 临时表问题 2022-01-01
- 更改自动增量起始编号? 2021-01-01