k4ml <[EMAIL PROTECTED]> writes:
> 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.
This works for me.
> 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()
(...)
> 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.
It works. Are you sure you haven't used quotes and called your schema
"Cvt" or "CVT" or ... or even your table "Customers"? Remember that if
you omit quotes, PostgreSQL downcases names and if you use them it will
respect your will and make a case sensitive search for the object.
Once you create something with quotes, you'll have to use them
everywhere, unless your name was all in lowercase...
--
Jorge Godoy <[EMAIL PROTECTED]>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---