Chinaunix首页 | 论坛 | 博客
  • 博客访问: 446587
  • 博文数量: 148
  • 博客积分: 4424
  • 博客等级: 上校
  • 技术积分: 1211
  • 用 户 组: 普通用户
  • 注册时间: 2010-08-25 21:50
文章分类

全部博文(148)

文章存档

2012年(89)

2011年(20)

2010年(39)

分类: SQLite/嵌入式数据库

2012-07-26 17:12:35

I want to drop a table from within Python. The command
  1. cur.execute('drop table if exists tab1')
and
  1. cur.executescript('drop table if exists tab1;')
both work fine if execute python script directly under Linux command window.

But why the first one doesn't work if call python script from
some tinuous integration tools, such as, Hudson (http://hudson.dev.java.net/)
Why ?


My script for example: drop.py

  1. import os, re
  2. import sqlite3

  3. conn = sqlite3.connect("./SQLiteDatabase.db3")
  4. cursor = conn.cursor()

  5. cursor.execute("drop view if exists table1")
  6. cursor.executescript("drop view if exists table2;")
  7. conn.close()



阅读(1021) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~