SQLAlchemy - 用于测试的 SQLite 和用于开发的 Postgresql - 如何移植? [英] SQLAlchemy - SQLite for testing and Postgresql for development - How to port?

查看:24
本文介绍了SQLAlchemy - 用于测试的 SQLite 和用于开发的 Postgresql - 如何移植?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的所有测试中使用 sqlite 内存数据库,在我的开发/生产服务器上使用 Postgresql.

I want to use sqlite memory database for all my testing and Postgresql for my development/production server.

但是两个数据库中的 SQL 语法并不相同.例如:SQLite 有自动增量,而 Postgresql 有串行

But the SQL syntax is not same in both dbs. for ex: SQLite has autoincrement, and Postgresql has serial

将 SQL 脚本从 sqlite 移植到 postgresql 是否容易...您的解决方案是什么?

Is it easy to port the SQL script from sqlite to postgresql... what are your solutions?

如果您要我使用标准 SQL,我应该如何在两个数据库中生成主键?

If you want me to use standard SQL, how should I go about generating primary key in both the databases?

推荐答案

不要这样做.不要在一种环境中测试并在另一种环境中发布和开发.您使用此流程要求有错误的软件.

Don't do it. Don't test in one environment and release and develop in another. Your asking for buggy software using this process.

这篇关于SQLAlchemy - 用于测试的 SQLite 和用于开发的 Postgresql - 如何移植?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆