Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/oracle/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
通过连接到Oracle DB使用Python Web app绘制图形_Python_Oracle_Web Applications - Fatal编程技术网

通过连接到Oracle DB使用Python Web app绘制图形

通过连接到Oracle DB使用Python Web app绘制图形,python,oracle,web-applications,Python,Oracle,Web Applications,我对Python世界还比较陌生。我想知道如何使用Python生态系统实现低于要求的目标, 1.简单的交互式网页供用户选择日期范围。 例如,订单数据的“天数”范围选择。 2.基于天数范围选择的Oracle 11g DB中的Ferch数据。 3.将数据转换为条形图,并在Web应用程序上显示 我在谷歌上搜索了一下,但没有找到任何完整的信息。 非常感谢。 谢谢 Yogesh有几种可用的方法,包括使用python库sqlalchemy或pandas。但是,对于我在这里描述的方法,您需要安装以下Python

我对Python世界还比较陌生。我想知道如何使用Python生态系统实现低于要求的目标, 1.简单的交互式网页供用户选择日期范围。 例如,订单数据的“天数”范围选择。 2.基于天数范围选择的Oracle 11g DB中的Ferch数据。 3.将数据转换为条形图,并在Web应用程序上显示

我在谷歌上搜索了一下,但没有找到任何完整的信息。 非常感谢。 谢谢
Yogesh

有几种可用的方法,包括使用python库
sqlalchemy
pandas
。但是,对于我在这里描述的方法,您需要安装以下Python库

  • cx\U Oracle

  • matplotlib

    我不会解释从网页获取用户输入的方法,也不会将绘图存储为图像并在网页上显示绘图。您可以通过谷歌搜索或参考以下问题了解各种方法:-

假设您已经读取了用户输入和存储在变量
st_date
end_date
中的两个日期。这是代码

import cx_Oracle
import matplotlib.pyplot as plt


query = 'SELECT order_date, count(order_id) order_count
     FROM orders WHERE order_date BETWEEN ' + st_date + ' AND ' + end_date +
         ' GROUP BY order_date '

order_date =  []
order_count = []


#connect to database and execute query.
db = cx_Oracle.connect('user', 'password', 'localhost:1521/XE')
cursor = db.cursor()
cursor.execute(query)

#loop through the rows fetched and store the records as arrays.
for row in cursor:
    order_date.append(row[0])
    order_count.append(row[1])

#plot the bar chart

plt.bar(order_date,order_count)

非常感谢Kaushik。感谢您的快速帮助。我可以用django来开发一个网页吗。从用户那里获取输入。当用户提交表单时。2.从OracleDB3获取数据。绘制条形图,并通过网页将响应作为html响应返回给用户。再次感谢。你好,约格什