ah yeah the first would be fixed by ticket #233, i.e. a TODO.

for the second, we currently dont have any support for CREATE SCHEMA,  
(nor do we have things like ALTER, CREATE VIEW, stored procedure  
management, etc).  the create/drop/reflection capabilities of SA are  
meant for small, self-packaging applications and assumes that more  
sophisticated schemas would be created by DDLs or real schema  
management applications.

not that SA will never support CREATE SCHEMA, but its lower priority  
since not every DB even supports CREATE SCHEMA and also SA is not  
trying to be a replacement for DDLs.

On Aug 5, 2006, at 6:11 PM, Tzahi Fadida wrote:

> I am using postgresql.
> When i use the schema keyword in Table(),
> if there is already a table with the same name in
> the "public"/default schema then metadata.create_all()
> assumes the schema (other than public) and table already exists.
> I.e. instead of checking in the requested schema it uses "public".
>
> The second bug, is if i now drop the table from the "public" schema
> and do metadata.create_all(), sqlalchemy does not attempt to create
> the schema before creating the table and throws a ProgrammingError:
>
>>>> metadata.create_all()
> [2006-08-06 00:53:12,228] [engine]: select relname from pg_class where
> lower(relname) = %(name)s
> [2006-08-06 00:53:12,229] [engine]: {'name': 'users'}
> [2006-08-06 00:53:12,237] [engine]:
> CREATE TABLE nis2.users (
>         user_id SERIAL NOT NULL,
>         user_name VARCHAR(40),
>         password VARCHAR(10),
>         PRIMARY KEY (user_id)
> )
>
>
> [2006-08-06 00:53:12,238] [engine]: None
> [2006-08-06 00:53:12,249] [engine]: ROLLBACK
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File "build/bdist.linux-i686/egg/sqlalchemy/schema.py", line 768, in
> create_all
>   File "build/bdist.linux-i686/egg/sqlalchemy/engine/base.py", line  
> 456, in
> run_callable
>   File "build/bdist.linux-i686/egg/sqlalchemy/schema.py", line 767,  
> in do
>   File "build/bdist.linux-i686/egg/sqlalchemy/engine/base.py", line  
> 298, in
> create
>   File "build/bdist.linux-i686/egg/sqlalchemy/engine/base.py", line  
> 399, in
> create
>   File "build/bdist.linux-i686/egg/sqlalchemy/engine/base.py", line  
> 423, in
> _run_visitor
>   File "build/bdist.linux-i686/egg/sqlalchemy/schema.py", line 209, in
> accept_schema_visitor
>   File "build/bdist.linux-i686/egg/sqlalchemy/ansisql.py", line  
> 639, in
> visit_table
>   File "build/bdist.linux-i686/egg/sqlalchemy/engine/base.py", line  
> 685, in
> execute
>   File "build/bdist.linux-i686/egg/sqlalchemy/engine/base.py", line  
> 354, in
> proxy
>   File "build/bdist.linux-i686/egg/sqlalchemy/engine/base.py", line  
> 319, in
> _execute_raw
>   File "build/bdist.linux-i686/egg/sqlalchemy/engine/base.py", line  
> 338, in
> _execute
> sqlalchemy.exceptions.SQLError: (ProgrammingError) schema "nis2"  
> does not
> exist
>  '\nCREATE TABLE nis2.users (\n\tuser_id SERIAL NOT NULL, \n 
> \tuser_name
> VARCHAR(40), \n\tpassword VARCHAR(10), \n\tPRIMARY KEY (user_id)\n) 
> \n\n' {}
>
> -- 
> Regards,
>         Tzahi.
> --
> Tzahi Fadida
> Blog: http://tzahi.blogsite.org | Home Site: http://tzahi.webhop.info
> WARNING TO SPAMMERS:  see at
> http://members.lycos.co.uk/my2nis/spamwarning.html
>
> ---------------------------------------------------------------------- 
> ---
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to  
> share your
> opinions on IT & business topics through brief surveys -- and earn  
> cash
> http://www.techsay.com/default.php? 
> page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Sqlalchemy-users mailing list
> Sqlalchemy-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to