一个可以轻松连接和使用旧 Oracle DB 的 Python Web 框架?

发布于 2025-01-06 05:45:03 字数 1959 浏览 0 评论 0原文

我希望获得一些关于 Web 应用程序框架的建议(强烈推荐 Python,但 Ruby 也可以),我可以学习这些框架来帮助我最终解决我们组织中的需求。

我想创建一个图表/图形应用程序,它可以帮助我们以新的方式更好地分析我们拥有的大量数据,以发现趋势等,而无需为每个不同的场景投入大量时间。

第一部分是根据我们的数据创建图表的应用程序。我们已经使用了 Crystal Reports 等工具,但我希望创建的是具有更多商业智能以及以一次性/临时方式将数据链接在一起的能力的东西。

以下是我希望完成的一些细节:

  • 用户级别控制/权限。谁可以在哪些领域进行 CRUD。
  • 与旧版 Oracle 数据库链接,并从 Oracle 执行尽可能多的查询(只读)
  • 根据 Oracle 数据库中的数据创建一些聚合统计信息(每月、每日、每 15 分钟),这些数据经过操作以提供不同类型的统计信息在 Oracle 数据库中不可用。这些可能会存储在本地数据库上。我正在考虑的就是计划任务,这样本地的数据就会定期自主更新。
  • 使用 Google Chart Tools 或 Highcharts 等图形库将数据链接到 HTML。漂亮的图表,生成起来并不繁琐(对于我或服务器来说),并提供更新/过滤图表结果的控件,例如使用滑块限制时间片或通过下拉列表过滤结果。
  • 必须在 Windows Server 上运行。

我已经研究了一些框架,每个框架都有我喜欢的东西,但作为 Web 框架世界的新手,我不太确定我是否意识到我可能在这里遇到的“陷阱”是我迄今为止的观察。请注意,其中一些可能不真实,我试图研究这些问题,但将 Web 应用程序连接到 Oracle 是一种边缘案例,没有很多人这样做,因此信息并不像 PostgreSQL 或 MySQL 那样丰富。

  • Web2Py – 这对于新开发人员来说似乎是最友好的,这对我很有吸引力。在一天左右的时间里,我能够启动并运行一个基本站点,并将其连接到一些虚拟数据以输出一些基本的 Google 图表工具。我开始研究连接到 Oracle 服务器,发现虽然它似乎对“遗留”连接类型有相当不错的支持,但有必要手动定义遗留数据库中的每个模型。对我来说这会有问题。几百个表,每个表有 30-150 列,这意味着需要大量“手工编码”,一些非常乏味的东西。除此之外,每年添加表/模式更改 2-3 次,这将是管理的噩梦。我真正喜欢 web2py 的一件事是它内置了一个调度程序,因此定期从 Oracle 中提取必要的数据将相当简单。

  • Django – 当我发现在 Web2Py 中完成所有建模的 PITA 时,我立即查看 Django,看看它能提供什么。它对模块创建有更好的支持,提供了基于遗留数据库创建模型的工具。文档甚至承认它并不完美,但如果稍微手动调整一下,它可能会让我达到 90%,这可能会非常有帮助。不幸的是它没有任何官方的、只有对 Oracle 的非常基本的支持。

  • Flask – 我之所以选择 Flask,是因为我在 SQLAlchemy 方面获得了很好的经验。我没有像研究 Web2Py 或 Django 那样花那么多时间研究 Flask,但我看到的看起来不错。在再次搜索 webapp 文档后,我决定应该咨询一些专家的建议,并来到这里发帖。 正如我提到的,我使用了 SQLAlchemy,并且非常喜欢这种方式,我能够相当轻松地为我的模型定义基本框架,并告诉 Alchemy 从 Oracle 加载数据,我认为我仍然需要添加关系,但如果这就是我所需要的补充一下,我在比赛中遥遥领先。

我知道有些人用 SQLAlchemy 替换 Django ORM,但我想知道这是否是一场持续的艰苦战斗,或者是否值得认真对待?

我的偏好和能力更倾向于 Python 框架,但我已经完成了一些 Ruby 工作,并且不会反对可以完成所有这一切的真正出色的 Ruby 框架。

除此之外,我欢迎任何澄清请求以及任何评论。就像我说的,我对 Web 框架相当陌生,实际上非常喜欢学习新事物,但希望将时间花在有效地启动这个项目上,而不是深入研究之后才发现我应该选择不同的框架。

I'm looking to get some advice on a web application framework (strong preference for Python, but Ruby is OK too) that I can learn to help me eventually solve a need we have in my organization.

I'd like to create a chart/graph app that can help us better analyze the large amounts of data we have in new ways to find trends etc without investing lots of time for each different scenario.

The first part of this is the app to create charts from our data. We already use tools like Crystal Reports, but what I'm looking to create is something with a bit more business intelligence and the ability to link data together in a one off/add-hoc way.

Here are some of the specifics I'm hoping to accomplish:

  • User level control/permissions. Who can CRUD on what areas.
  • Link with legacy Oracle db and do as much querying (read only) as possible from Oracle
  • Create some aggregate statistics (Monthly, Daily, every 15 min) based on data from the Oracle DB that is manipulated to provide a different type of statistic that is not available in the Oracle db. These would probably be stored on a local db. A scheduled tasks is the kind of thing I am thinking, so the data locally would update autonomously at regular intervals.
  • Use a graphing library like Google Chart Tools or Highcharts to link the data to the HTML. Nice looking charts that are not burdensome to generate (for me or the server) and provide controls to update/filter the chart results for example limit the time time slice with a slider or filter results via a dropdown.
  • Must operate on a Windows Server.

I have looked at a few frameworks and each has things that I like, but as a newcomer to the web framework world I am not really sure that I am aware of the “gotchas” I might run into here has been my observations so far. Note some of these may not be factual, I tried to research these issues but connecting webapps to Oracle is kind of a fringe case that not a lot of people do, so information is not as prolific as say PostgreSQL or MySQL.

  • Web2Py – This seems to be the friendliest for the new developer, which is appealing to me. In the span of a day or so I was able to get a basic site up and running and connecting it to some dummy data to output some basic Google Chart Tools. I started researching connecting to Oracle servers and found that while it seems to have fairly decent support for the type of “legacy” connections, it is necessary to define by hand each model from the legacy database. For me this would be problematic. A few hundred tables with 30-150 columns each means a lot of “hand coding” some really tedious stuff. Add on top of that the fact that tables are added/schemas change 2-3 times a year, and it would be a management nightmare. One thing I really liked about web2py was that it had a scheduler built in, so pulling the necessary data from oracle on a regular basis would be fairly simple.

  • Django – Once I discovered what a PITA it was going to be to do all the modeling in Web2Py I immediately looked at Django to see what it had to offer. It has better support for the module creation, providing a tool to create a model based on a legacy database. The documentation even admits it isn't perfect, but it would probably get me 90% there with a bit hand tweaking it could be very helpful. Unfortunately it doesn't have any official, and only very basic support for Oracle.

  • Flask – I looked at Flask because of a good experience I had with SQLAlchemy when it came to this stuff. I didn't spend as much time looking at Flask as I had spent looking at Web2Py or Django, but what I saw looked nice. After facing another search through webapp documentation I decided I should consult some expert advice, and came here to post.
    As I mentioned I used SQLAlchemy and really liked the way I was able to fairly easily define a basic skeleton for my model and tell alchemy to load the data from Oracle I think I would still need to add relationships but if that is all I have to add I'm way ahead of the game.

I know some people swap out the Django ORM with SQLAlchemy, but I wonder if that is a constant uphill battle or if it is something worth seriously undertaking?

My preference and ability lean more towards the Python frameworks, but I have done some Ruby work and would not be opposed to a really great Ruby framework that could accomplish all of this.

Beyond that I welcome any requests for clarification as well as any comments. Like I said I am fairly new to web frameworks and actually really enjoy learning new things, but want to spend my time productively working towards a launch of this project, not getting deep into things only to find I should have chosen a different framework.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

做个少女永远怀春 2025-01-13 05:45:04

一旦我发现在 Web2Py 中完成所有建模将是一个什么样的 PITA,我立即查看 Django,看看它必须提供什么。它对模块创建有更好的支持,提供了基于遗留数据库创建模型的工具。

我假设你正在谈论 Django 的 inspectdb 工具。请注意,web2py 包含一个类似工具 - 它是创建用于 PostgreSQL,但只需稍加调整即可与其他数据库一起使用(即,将数据库驱动程序更改为 Oracle)。如果您需要任何帮助,请随时在邮件列表中提问。

Once I discovered what a PITA it was going to be to do all the modeling in Web2Py I immediately looked at Django to see what it had to offer. It has better support for the module creation, providing a tool to create a model based on a legacy database.

I assume you're talking about Django's inspectdb tool. Note, web2py includes a similar tool -- it was created for use with PostgreSQL but should be usable with other databases with minor tweaks (i.e., change the database driver to Oracle). If you need any help, feel free to ask on the mailing list.

雪落纷纷 2025-01-13 05:45:04

主要关注的是与 oracle db 的连接渲染图表
DB - 最好的选择是 SQLAlchemy,因为它比其他 ORM 更好地支持 oracle

如果您希望 pythonic 库渲染图表,您可以使用numpyscipy 图表,有支持 google 图表的 python 库代码> API.如果您正在构建一个与 google 图表 交互的应用程序,则应查看请求请求

当涉及到 Web 框架时,如果 ORM 被默认的 ORM 取代,那么您几乎就只剩下 formswsgi 和额外的组件了。在这种情况下,我将回退到支持 RESTflask 和由 Armin 的创建者 Armin 编写的 flask.sqlalchemy。代码>Flask 和werkzeug

您也有 flask admin 扩展。

The main concern is connection to oracle db and rendering charts.
DB- The best bet is SQLAlchemy because it supports oracle much better than other ORM out there.

Incase you want pythonic libraries to render charts you can usenumpy and scipy charts, there are python libraries which supports google charts api. If you are building one to interact with google charts should have a look at requests requests.

When it comes to web framework, if ORM is replaced by default one ,you are pretty much left out with forms, wsgi and extra components. In this case I will fallback to flask which supports REST anf flask.sqlalchemy written by Armin the creator of Flask and werkzeug.

You have flask admin extension too.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文