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

查看:59
本文介绍了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天全站免登陆