I fail to understand what you want to do. Do you want to reflect the
table from the database or you want it created by Elixir?

In the first case, you need to specify the autoload option to your
entity, as in:
    using_options(autoload=True)

In the second case, your code is missing a "create_all()" which will
actually create the table in the database.

Hope this helps,

On 4/20/07, k4ml <[EMAIL PROTECTED]> wrote:
>
> What if I have a table in schema other than public in Postgresql ? I
> try the following:-
>
> from elixir import *
>
> metadata.connect("postgres://kamal:[EMAIL PROTECTED]/clinic_live")
>
> class Customer(Entity):
>     has_field('id', Integer, primary_key=True)
>     has_field('name', String)
>     using_options(tablename='cvt.customers')
>
> The schema name is cvt.
>
> Will throw:-
>
> Python 2.4.1 (#1, Oct 13 2006, 16:58:04)
> [GCC 4.0.2 20050901 (prerelease) (SUSE Linux)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> from model import *
> >>> Customer.select()
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File "build/bdist.linux-i686/egg/sqlalchemy/ext/assignmapper.py",
> line 7, in do
>   File "build/bdist.linux-i686/egg/sqlalchemy/orm/query.py", line 301,
> in select
>   File "build/bdist.linux-i686/egg/sqlalchemy/orm/query.py", line 309,
> in select_whereclause
>   File "build/bdist.linux-i686/egg/sqlalchemy/orm/query.py", line 798,
> in _select_statement
>   File "build/bdist.linux-i686/egg/sqlalchemy/orm/query.py", line 694,
> in execute
>   File "build/bdist.linux-i686/egg/sqlalchemy/orm/session.py", line
> 183, in execute
>   File "build/bdist.linux-i686/egg/sqlalchemy/engine/base.py", line
> 444, in execute
>   File "build/bdist.linux-i686/egg/sqlalchemy/engine/base.py", line
> 484, in execute_clauseelement
>   File "build/bdist.linux-i686/egg/sqlalchemy/engine/base.py", line
> 503, in execute_compiled
>   File "build/bdist.linux-i686/egg/sqlalchemy/engine/base.py", line
> 499, in proxy
>   File "build/bdist.linux-i686/egg/sqlalchemy/engine/base.py", line
> 547, in _execute_raw
>   File "build/bdist.linux-i686/egg/sqlalchemy/engine/base.py", line
> 566, in _execute
> sqlalchemy.exceptions.SQLError: (ProgrammingError) ERROR:  relation
> "cvt.customers" does not exist
>
> SELECT "cvt.customers".id AS cvtcustomers_id, "cvt.customers".name AS
> cvtcustomers_name
> FROM "cvt.customers" ORDER BY "cvt.customers".id 'SELECT
> "cvt.customers".id AS cvtcustomers_id, "cvt.customers".name AS
> cvtcustomers_name \nFROM "cvt.customers" ORDER BY
> "cvt.customers".id' {}
>
> I tested in psql. Look's like SELECT "tablename".somefield would work
> but SELECT "schemaname.tablename".somefield is not.
>
> Sorry if this is known problem, I try to search this group but none
> discussion about it exist.
>
>
> >
>


-- 
Gaƫtan de Menten
http://openhex.org

--~--~---------~--~----~------------~-------~--~----~
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