<div dir="ltr">If I understand correctly you want to purge rows from a table and reset the table's autoincrement counter. There is no such functionality in Pony yet, but you can do that manually using raw SQL.<br><br>Below is the code for SQLite:<br>
<br>��� def purge_table(entity):<br>������� # purge rows from the table<br>������� sql1 = 'delete from "%s"' % entity._table_<br>������� db.execute(sql1)<br><br>������� # reset the autoincrement counter<br>
������� sql2 = "delete from sqlite_sequence where name='%s'" \<br>������������������������������ % entity._table_<br>������� db.execute(sql2)<br><br>��� purge_table(MaterialTransaction)<br><br>In SQLite table names should be in double quotes and strings should be in single quotes, that is why the queries above use different quotes (<a href="https://www.sqlite.org/lang_keywords.html">https://www.sqlite.org/lang_keywords.html</a>)<br>
<br>If you're using another database, let us know which one.<br><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Dec 19, 2013 at 2:45 AM, Guy Jacks <span dir="ltr"><<a href="mailto:guy.jacks@gmail.com" target="_blank">guy.jacks@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I'm currently calling.<div><br></div><div>db.drop_table(...) and then calling db.create_tables() in order to purge all of the data. �I'm using flask so I wrapped my app in the with_transaction context. �I'm getting the following error.</div>


<div><br></div><div><a href="https://gist.github.com/anonymous/9005f162fc6f352a73fc" target="_blank">https://gist.github.com/anonymous/9005f162fc6f352a73fc</a><br></div><div><br></div><div>Note, I don't want to delete all the rows because I want to reset the auto-increment on the ids.</div>


</div>
<br>_______________________________________________<br>
ponyorm-list mailing list<br>
<a href="mailto:ponyorm-list@ponyorm.org">ponyorm-list@ponyorm.org</a><br>
<a href="/ponyorm-list" target="_blank">/ponyorm-list</a><br>
<br></blockquote></div><br></div></div>