Le vendredi 07 juillet 2006 à 10:28 -0400, Emily Fortuna a écrit :
> Hello everyone,
> How can  you delete an entire table (so that you can set up a new one 
> with different columns -- I'm using SQLite)? I've been searching all 
> over the web and can't seem to find it.
> Emily

Here is a little example : 
-----------------------------------------------------------------------
def delete_all_data(tlist):
  '''
  Purge the database of all its data.

  @param tlist: table names to purge
  @type tlist: list
  '''
  for table in tlist:
    con = table._connection
    try:
      con.query(con.sqlrepr(sqlbuilder.Delete(table.sqlmeta.table,
where=None)))
    except Exception:
      #ignore exception when trying to delete non-existent tables.
      pass
-----------------------------------------------------------------------

Didrik

Attachment: signature.asc
Description: Ceci est une partie de message numériquement signée

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to