python连接数据库出报表

Python连接Oracle数据库进行数据处理操作 1. Python连接Oracle数据库? 2. Python查询、提取Oracle数据库中数据? 3. 通过Python在Oracle数据库中创建表 4. Python数据插入到Oracle数据库中? 5. Python删除Oracle数据库中数据? 阅读详情
python连接oracle数据库后,读取sql文件,以;分隔,遍历执行sql,将列名和记录打印出来
#!/usr/bin/python
#coding=utf8
###应该数据库连接和游标作为返回值使用,分别关闭
import cx_Oracle as cx_ora
import os

#os.environ['NLS_LANG']="SIMPLIFIED CHINESE_CHINA.UTF8"
os.environ['NLS_LANG']="AMERICAN_AMERICA.AL32UTF8"

def connDB(username='dbaro',passwd='VgcAv1f4JNRvqMokXS9v',dbdomain='192.168.54.21',port='1521',sid='slave'):
        tns=cx_ora.makedsn(dbdomain,port,sid) #使用makedsn配置tns_name
        conn=cx_ora.connect(username,passwd,tns)
        return conn

def closeDB(conn):
        conn.close()
def queryColumn(conn,sql):
        cur=conn.cursor() ##可以反复使用
        cur.execute(sql)
        desc=cur.description
        cur.close()
        return desc

def queryRecord(conn,sql):
        cur=conn.cursor()
        cur.execute(sql)
        records=cur.fetchall()
        cur.close()
        return records

def deleteData(conn,sql):
        cur=conn.cursor()
        cur.execute(sql)      
        cur.close()
        conn
Pycharm连接达梦数据库做数据分析报表 试验目的:Windows主机仅安装Pycharm,远程连接达梦数据库服务器(以虚拟机CentOS7版代替)做数据报表。 试验环境: Windows版Pycharm2021.3.2; Linux版Python-3.9.8; CentOS7版DN8镜像:DMInstall.bin(提前解压出来的.bin文件); VMware16虚拟机(CentOS7版系统),并创建与主机的共享文件夹。 阅读详情

相关推荐

Python实现自动化报表

product_analysis['销售额占比'] = (product_analysis['销售额'] / product_analysis['销售额'].sum()).round(4)monthly['利润率'].plot(kind='line', marker='o', ax=ax3, color='green')monthly['销售额'].plot(kind='bar', ax=ax1, color='steelblue')

zpzsp60573的博客 1195

深入探索数据库领域的数据仓库架构

本文旨在为读者提供关于数据仓库架构的全面理解,涵盖从传统数据仓库到现代云数据仓库的演进过程。我们将重点讨论数据仓库的设计原则、实现技术和最佳实践。文章首先介绍数据仓库的基本概念,然后深入探讨其架构设计,接着通过实际案例展示实现方法,最后讨论未来发展趋势。数据仓库(Data Warehouse): 面向主题的、集成的、非易失的、随时间变化的数据集合,用于支持管理决策: 数据抽取、转换和加载的过程: 在线分析处理系统,支持复杂分析查询云数据仓库普及。

2502_91592937的博客 998

帆软报表嵌入python程序_FineReport -帆软报表开发步骤

在线学习视频:https://bbs.fanruan.com/edu/guide/finereport/3.html1.新建数据连接新建数据连接的目的是让 FineReport 设计器连接数据库,这样报表就可以在数据库中读取、写入或修改数据。数据连接的方式有两种,分别是连接内置数据库和连接外置数据库。制作这张报表连接的是 FineReport 内置的 SQLite 类型的数据库,有关外置数据库的连...

weixin_39551993的博客 1842

Python办公自动化实践:连接MySQL数据库实现每日定时批量发送报表邮件

需求:编写一个Python程序每天定时给业务人员发送报表。实现思路:要定期发送报表需要Python连接MySQL获取数据库每日更新的数据;然后把数据按照指定格式写入到Excel表格内,若有需求还可以在工作表内绘制图表;最后利用Python 的邮件发送模块把报表作为附件发送给收件人。在使用自定义程序发送邮件时需要先开通POP3/SMTP服务和IMAP/SMTP服务。代码中加入了while和if循环,使用了xlsxwriter模块替代df.to_excel命令,使用了openpyxl模块可以插入图片。

weixin_47296722的博客 1057

【Python】Python接入MySQL数据库

Python 以其简洁的语法、丰富的库生态系统以及在Web开发、数据分析、人工智能、自动化脚本等领域的广泛应用而著称。MySQL 则是世界上最流行的开源关系型数据库之一,以其稳定性、高性能和易用性而受到青睐。将两者结合,可以构建出功能强大、数据驱动的应用程序。Python 应用程序通过一个称为数据库连接器 (Database Connector) 或 驱动程序 (Driver) 的特定库来与 MySQL 服务器进行通信。这个连接器扮演着翻译官的角色,将 Python 代码中的数据库操作指令转换为 MySQL

宅男很神经 1615

嵌入式开发也玩“全家桶”?手把手教你用CLion+PyOCD调试APM32,比OpenOCD更简单

本文详细介绍了如何使用CLion和PyOCD组合进行APM32嵌入式开发,提供从环境配置到实战调试的完整指南。相比传统工具如Keil和OpenOCD,这套方案更轻量、易用,特别适合现代开发者需求,涵盖CMake配置、PyOCD调试技巧及常见问题解决。

weixin_42543046的博客 464

RPN 解析

RPN全称是Region Proposal Network,Region Proposal的中文意思是“区域选取”,也就是“提取候选框”的意思,所以RPN就是用来提取候选框的网络; 1. RPN的意义 RPN第一次出现在世人眼中是在Faster RCNN这个结构中,专门用来提取候选框,在RCNN和Fast RCNN等物体检测架构中,用来提取候选框的方法通常是Selective Se

lanran2的博客 10万+

信号削峰CFR基础知识介绍(一)

接下来,将得到的峰值分成若干段,在每一段中,仅保留该段内所有峰值中幅度最大的峰值。为了减少不必要的带外泄露,削峰后的信号将通过一个低通滤波器,以减少对应于削峰后信号中尖锐拐角的高频信号。首先,它识别出高于由目标PAPR确定的阈值的峰值。在峰值加窗算法中,削峰是通过在峰值区域将原始信号与一个加窗函数相乘来实现的,如下图所示。其中,w(n) 是一种常见的加窗函数,如凯撒窗、高斯窗和汉明窗等,而 p(n) 是一个加权系数。如上图所示,削峰会导致削峰后的信号出现尖锐的拐角,从而引发不必要的带外辐射(ACP增加)。

weixin_49761275的博客 1551

深入解析Flex NOC总线驱动的实时带宽与延迟优化策略

本文深入解析了Flex NOC总线驱动的核心价值与优化策略。通过解读`/proc/noc/real_time`中的实时带宽与延迟数据,并结合`sysfs`接口进行动态QoS调优,可以有效解决芯片内部数据拥堵问题。文章以智能摄像头和算力盒子的实际案例,详细说明了如何通过优先级调整、带宽限制和参数优化,提升系统在复杂任务下的实时性与稳定性。

weixin_29289821的博客 284

Mplus实战:三变量随机截距交叉滞后模型(RI-CLPM)语法详解与扩展

本文详细解析了Mplus中三变量随机截距交叉滞后模型(RI-CLPM)的构建原理与语法实现。通过将变量分解为稳定的个体间差异与动态的个体内波动,模型能更纯净地揭示多变量间的纵向交互影响。文章以工作压力、睡眠质量与工作满意度为例,提供了完整的语法模板、关键参数设置(如NOCOV命令、残差相关)及结果解读指南,帮助研究者避开常见误区,稳健分析复杂动态关系。

wdx0123456的博客 927

VS2019 +osg3.6.5+ earth3.2+qt5.14.2+osgQt 编译教程

用vs新建工程,稍后会在写一篇博客上分享四、结语至此,所有的编译就均已完成。

king_ink的博客 1134

UniApp 覆盖安装后首次进入 APP pages.json 不生效的解决方案

通过以上步骤,解决了缓存问题导致的首次加载异常。此方案的关键在于强制更新文件名,从根本上避免旧缓存的干扰。

代码简单说 Vue、JAVA、PHP、Node.js 熟练运用,接口、架构、性能全搞定。 684

告别 SAP GUI 事务码时代:手把手教你配置 SAP Fiori Launchpad

SAP S/4HANA私有云系统安装后,Fiori Launchpad空页面问题常因多层配置未完成所致。SAP仅提供基础技术配置,实际应用启用、业务目录创建、角色授权等需实施团队完成。Fiori配置分为跨客户端层(技术目录)、客户端定制层(业务目录、空间页面)和用户个性化层三层架构。标准授权流程需依次创建业务目录、业务角色、空间页面并正确分配。SAP建议使用最新的配置工具如FLPAM和FLPCM,并采用Spaces/Pages替代已弃用的Groups概念。完整授权需六步:分配基础角色、创建业务目录、维护业务

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 540

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

ssm框架搭建

这个是一个在idea上成功跑起来的ssm框架项目,保存在这里方便以后使用直接下载

上一篇: python使用cx_oracle连接oracle数据库
下一篇: 将oracle dml操作封装为类,成为一个模块
offbeatmine
博客等级 码龄13年 14粉丝 48原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值