pyodbc-的一些说明
2024-10-08 12:29:36
cursor的description 可以获得一些关于表的信息
info=cursor.description
此时表中有多少列就有多少个元素,一个元素就是一列的信息(格式是tuple),所以这里的info是个2层的tuple。
想要获得所有的列名,就用info[0][0], info[1][0], ......
在打开excel时,第一行默认是标题,不可更改。
打开不同的数据库就是连接不同,其他的用法都一样。
=========================================================
下面的来自官网,对description的说明
https://github.com/mkleehammer/pyodbc/wiki/Cursor#description
description
This read-only attribute is a list of 7-item tuples, one tuple for each column returned by the last SQL select statement. Each tuple contains:
- column name (or alias, if specified in the SQL)
- type code
- display size (pyodbc does not set this value)
- internal size (in bytes)
- precision
- scale
- nullable (True/False)
最新文章
- Redis-3.2.6 配置文件中文翻译
- hdu 1872(看病要排队)(优先队列)
- js一篇汇总
- python scrapy+Mongodb爬取蜻蜓FM,酷我及懒人听书
- DB2 日期相减
- (转)使用myeclipse生成实体类和hibernate映射文件
- Spring框架学习(二)
- JS和JQuery总结
- dos 下 查看和设置classpath的命令
- SqlServer日期(convert函数,getdate函数)
- JAR WAR EAR包的区别
- cocos2dx 魔塔项目总结(一)
- Generic(泛型)
- nyoj 开方数
- UVA4731:Cellular Network
- nodejs 搭建本地静态服务器
- Java并发编程-AbstractQueuedSynchronizer源码分析
- ajax二次封装之异步加载
- 【LOJ】 #2547. 「JSOI2018」防御网络
- h5新属性