当前位置:网站首页>企业微信上的应用如何与门店的sybase数据库关联
企业微信上的应用如何与门店的sybase数据库关联
2022-07-17 05:25:00 【CSDN问答】
现在门店的所有销售数据,都存储在sybase数据库里的数据
而我的企业微信上的应用(部署在阿里云服务器上)要关联到这个数据库,有很多数据的互动嘛
现在用到的办法是,把sybase数据库上的数据同步到阿里云的RDS数据库上,然后阿里云的云服务器上的程序再去读取RDS数据库上的数据
阿里云服务器 → 阿里云RDS数据库 → sybase数据库
每2秒查询一次,如果有销售数据产生,就把这个变动同步到阿里云的mysql数据库
我现在是用python的pandas.read_sql读取sybase数据库里的数据,如果有新增的数据,就发送到阿里云上,做mysql的增删改减的操作
inv_table = pd.read_sql('SELECT * FROM p_inv', self.sybase_engine1, parse_dates='psl_date').apply(lambda x: x.astype(str).str.encode('cp850').str.decode('gbk')) inv_table = inv_table[inv_table['piv_date'] == self.today.strftime('%Y-%m-%d')] last_bill_num = inv_table['piv_bill_no'].values.tolist()[-1] print(last_bill_num, bill_num) if last_bill_num >= f'0{bill_num}': cols = ','.join(inv_table.columns.values) df = inv_table[inv_table['piv_bill_no'] == f'0{bill_num}'] print(df) if not df.empty: inv_sql = f"insert into p_inv({cols}) values(%s{
' ,%s' * (len(inv_table.columns) - 1)})" cursor.execute(inv_sql, df.values.tolist()[0]) self.ali_sales_conn.commit() self.update_p_sale_store(cursor, f'0{bill_num}') self.ali_sales_conn.commit()
这个我感觉太复杂了,有没有更简单一点的办法呢,提供给我一个思路就行
边栏推荐
- Development board training: multi task program under stm32
- OpenSUSE install Netease cloud music (tumblefeed) (LEAP)
- Download, configuration and basic use of C language compiler
- Edit close automatically generate configuration file when saving
- 实时数据仓库-从0到1实时数据仓库设计&实现(SparkStreaming3.x)
- Classes and objects
- Network knowledge-03 data link layer Ethernet
- Gentoo installation tutorial (systemd+gnome)
- HMI概念设计的未来在哪里?
- High concurrency day04 (Zab protocol, observer, NC, Avro, RPC)
猜你喜欢
SQL刷题总结 SQL Leetcode Review
MySql
网络知识-05 传输层-UDP
Summary of Statistics for Interview
京东购买意向预测(四)
Review of 4121 Computer System for Data Science
Cracking Metric/Business Case/Product Sense Problems
Use Altium designer software to draw a design based on stm32
Coursera deep learning notes
Crawler Basics - session and cookies
随机推荐
What is the difference between SD NAND and nandflash?
AB Testing Review
What is the difference between Samsung series NAND flash?
Basic lighting knowledge of shader introduction
Administrator blocked this app from running
六十、清除缓存
Download, configuration and basic use of C language compiler
Ivew shuttle box transfer component highlights the operation value
Introduction to arm development environment
网络知识-03 数据链路层-PPP
环境变量和文件夹放置位置
Pytorch随记(1)
MySql
Review - 5703 Statistical Inference and Modeling
Xiaoyi and you talk about how to realize c-v2x HIL test in v2x test series (2022 version)
机器学习之随机森林
网络知识-02 物理层
shader入门之基础光照知识
一刻钟读懂gPTP
Spark3.x-实战之mysql方式实现kafka精准一次性消费