Great, works as expected now. 

Not sure I understand it completely - I guess calling `table` with an 
existing table links to it and provides access to whatever columns you 
specified. Have to read up some more. 

Thanks again for the help.

On Monday, October 1, 2012 10:39:43 PM UTC-5, Michael Bayer wrote:
>
> yeah you just need to create table() there with the columns you want as 
> well:
>
> proc_table = table('generalprocedures_lu', column('procedure', String))
> op.bulk_insert(proc_table, ...)
>
>
> On Oct 1, 2012, at 10:49 PM, Christopher Loverich wrote:
>
> Hello.* Loving* alembic & sqlachemy - really great libraries. Just having 
> a bit of trouble with something:
>
> op.create_table('generalprocedures_lu',
>     sa.Column('procedure', sa.String(length=80), nullable=False),
>     sa.PrimaryKeyConstraint('procedure')
>     )
>
> op.bulk_insert(table('generalprocedures_lu'),
>         [
>             {'procedure':u'Fetoscopic guided laser photocoagulation'}
>         ],
>         )
>
>
> The above fails with:
> sqlalchemy.exc.IntegrityError: (IntegrityError) null value in column 
> "procedure" violates not-null constraint
>  'INSERT INTO generalprocedures_lu DEFAULT VALUES'* {}*
>
> If I attempt to insert multiple rows, alembic seems to try and insert 
> multiple empty {}'s. Also, *confused* about the 'DEFAULT' argument. 
>
> My apologies if I'm doing something very wrong here (ott single column 
> lookup table ^^), but I"m not sure what to try as a work-around. I 
> attempted using a traditional lookup table with an integer primary key, but 
> got the same results. If I leave out the bulk insert, I can manually put in 
> values. Database is Postgres 9.2 (if relevant). Let me know if I need to 
> give a more complete example. 
>
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/sqlalchemy/-/baybV1cO4ecJ.
> To post to this group, send email to sqlal...@googlegroups.com<javascript:>
> .
> To unsubscribe from this group, send email to 
> sqlalchemy+...@googlegroups.com <javascript:>.
> For more options, visit this group at 
> http://groups.google.com/group/sqlalchemy?hl=en.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sqlalchemy/-/lZzxXelyEtoJ.
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