On Jul 29, 2009, at 10:48 PM, Jon Nelson wrote:

>> sure just use default=my_callable(ctx).  the ctx contains the bind
>> parameters for the current row.   you could also just use a  
>> MapperExtension.
>
> I am not sure how to apply a default when not defining the columns - I
> am sadly using database reflection.
>
> I tried using MapperExtension (using before_insert) but nodeid is
> still None at that point that before_insert is called.

oh this is MySQL right ?  yeah you're out of luck unless you manually  
generate the ID beforehand.  There is no way, well *maybe* a trigger  
can do it, to insert such a row on MySQL using its normal  
autoincrement feature and that has nothing to do with SQLAlchemy.  see  
if triggers can do it.  otherwise you need to change your schema.   
I've used a schema like this many times and parent_id simply must be  
nullable.




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to