sqlite empty inserts

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sapsi

    sqlite empty inserts

    Hello,
    I created a table like:

    create table __saved_query__ (vdb_name text , query_table_nam e text
    PRIMARY KEY, query text)

    and then I insert as follows

    self.cursor.exe cute( "insert into __saved_query__ (vdb_name,
    query_table_nam e, query) values (?,?,?)", (vdbname,
    foldername,wher e_query))
    self.conn.commi t()
    Now for some reason, the first insert works, but thereafter all
    inserts result in empty rows
    e.g
    sqliteselect * from __saved_query__ ;
    TestVDB|test_b| title regexp 'boo'
    ||
    ||

    The last two rows are from the 2nd and 3rd inserts. The values i;m
    inserting are non null.

    Any ideas?

    Thank you for your time
    Saptarshi

  • Peter Otten

    #2
    Re: sqlite empty inserts

    sapsi wrote:
    I created a table like:
    >
    create table __saved_query__ (vdb_name text , query_table_nam e text
    PRIMARY KEY, query text)
    >
    and then I insert as follows
    >
    self.cursor.exe cute( "insert into __saved_query__ (vdb_name,
    query_table_nam e, query) values (?,?,?)", (vdbname,
    foldername,wher e_query))
    self.conn.commi t()
    Now for some reason, the first insert works, but thereafter all
    inserts result in empty rows
    e.g
    sqliteselect * from __saved_query__ ;
    TestVDB|test_b| title regexp 'boo'
    ||
    ||
    >
    The last two rows are from the 2nd and 3rd inserts. The values i;m
    inserting are non null.
    >
    Any ideas?
    Change the query to ... query_table_nam e text PRIMARY KEY NOT NULL ... to
    verify that assertion before you look any further.

    Peter

    Comment

    • sapsi

      #3
      Re: sqlite empty inserts

      I forgot to mention that i was creating a view just before this i.e
      sql="create view %s as %s" % (foldername, query)
      # self.cursor.exe cute(sql)
      self.cursor.exe cute(sql)

      Now if i remove this, the insert code works fine.
      Regards
      Saptarshi

      Comment

      Working...