On Thu, 2010-06-24 at 10:36 -0700, Chris Curvey wrote:
> A long time since I've been here.  I'm sure you all have missed me
> (not!).

Glad to read you again...

> Anyway,  I'm trying to do an autoload of some tables that are in an MS-
> SQL database (because they're big tables and I don't feel like
> typing), like so:
> 
> import elixir
> elixir.metadata.bind = "mssql+pyodbc://ZGA_Application_1395"
> class ARTran(elixir.Entity):
>     elixir.using_options(tablename='ARTran', autoload=True)
> elixir.setup_all()
> 
> but I'm getting an error of " Mapper could not assemble any primary
> key columns for mapped table 'ARTran'"
> 
> And if i put in the fields that *are* in the primary key, like so:
> 
> import elixir
> elixir.metadata.bind = "mssql+pyodbc://ZGA_Application_1395"
> class ARTran(elixir.Entity):
>     elixir.using_options(tablename='ARTran', autoload=True)
>     CustId = elixir.Field(elixir.String(15), primary_key=True)
>     TranType = elixir.Field(elixir.String(2), primary_key=True)
>     RefNbr = elixir.Field(elixir.String(10), primary_key=True)
>     LineNbr = elixir.Field(elixir.Integer, primary_key=True)
>     RecordID = elixir.Field(elixir.Integer, primary_key=True)
> elixir.setup_all()
> 
>  I get "Column CustId already exists in table ARTran"
> 
> So, how do I autoload a table and specify the primary key?

I think you are looking for using_options(allowcoloverride=True) 

Hope it helps,
Gaetan

-- 
You received this message because you are subscribed to the Google Groups 
"SQLElixir" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sqlelixir?hl=en.

Reply via email to