Ok, I'd rather handle it on the database level. Is that just a matter
of creating a function and calling it on insert?
Koen
On Apr 13, 4:47 am, Ants Aasma [EMAIL PROTECTED] wrote:
On Apr 13, 2:47 am, Jorge Godoy [EMAIL PROTECTED] wrote:
IF you insist on doing that at your code, make the
request_table = Table('request', metadata,
Column('id', Integer, primary_key=True),
Column('number', Integer, unique=True, nullable=True,
default=text('(SELECT coalesce(max(number), 0) + 1 FROM
request)')))
This seems to work well. But is this a good way to do
On Apr 13, 1:47 pm, Koen Bok [EMAIL PROTECTED] wrote:
request_table = Table('request', metadata,
Column('id', Integer, primary_key=True),
Column('number', Integer, unique=True, nullable=True,
default=text('(SELECT coalesce(max(number), 0) + 1 FROM
Koen Bok [EMAIL PROTECTED] writes:
I need to have a uninterrupted number sequence in my table for
invoices. I was trying to do it like this, but I can't get it to work.
Can anyone give me a hint?
Let your database do the job. It is always aware of all connections
made to it, their contexts,
On Apr 13, 2:47 am, Jorge Godoy [EMAIL PROTECTED] wrote:
IF you insist on doing that at your code, make the column UNIQUE (or a
PK...) and write something like this pseudocode:
def save_data():
def insert_data():
try:
unique_column_value =