简体   繁体   English

具有共享数据库的多个 Python 应用程序的架构模式

[英]Architectural pattern for multiple Python applications with shared database

The project consists of two applications in Python with a single shared database:该项目由 Python 中的两个应用程序组成,具有一个共享数据库:

  • Application A: performs preprocessing of raw data and stores it in the database;应用A:对原始数据进行预处理并存入数据库;

  • Application B: performs data analysis techniques on the already populated database.应用程序 B:对已填充的数据库执行数据分析技术。

在此处输入图像描述

What should be the right architectural pattern for such a context?对于这样的上下文,正确的架构模式应该是什么?

Also, so far I have been using MongoDB and Flask to populate the database but I don't know if it would be suitable as a choice.另外,到目前为止,我一直在使用 MongoDB 和 Flask 来填充数据库,但我不知道它是否适合作为一个选择。

If you are asking about a database access pattern, you can always use ORMs (Object relational mappers).如果您询问数据库访问模式,您总是可以使用 ORM(对象关系映射器)。 An object-relational mapper (ORM) is a code library that automates the transfer of data stored in relational database tables into objects that are more commonly used in application code.对象关系映射器 (ORM) 是一种代码库,可自动将存储在关系数据库表中的数据传输到应用程序代码中更常用的对象中。

You can learn more about ORM in here.您可以在此处了解有关 ORM 的更多信息。 https://www.fullstackpython.com/object-relational-mappers-orms.html https://www.fullstackpython.com/object-relational-mappers-orms.html

I believe this would be better suited for python than the DAO pattern we use in java. https://www.tutorialspoint.com/design_pattern/data_access_object_pattern.htm我相信这比我们在 java 中使用的 DAO 模式更适合python。https://www.tutorialspoint.com/design_pattern/data_access_object_pattern.htm

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM