did you commit your transaction or set autocommit=True in your text()
statement ? that string you have will not trip off SQLA's "autocommit"
feature.
Faheem Mitha wrote:
>
> Confirmed by Alex Grönholm on #postgresql on freenode with pg 8.3 and sqla
> 0.5.6. If this is not a bug, i'd like to know what is going on. Typing the
> text in gq directly into psql (all on one line) produces the schema foo as
> expected.
>
> Regards,
> Faheem.
>
> btsnp=# \dn
> List of schemas
> Name | Owner
> --------------------+----------
> information_schema | postgres
> pg_catalog | postgres
> pg_toast | postgres
> pg_toast_temp_1 | postgres
> public | postgres
> (5 rows)
>
> btsnp=# SET search_path TO public; DROP SCHEMA IF EXISTS foo CASCADE;
> CREATE SCHEMA foo;
> SET
> NOTICE: schema "foo" does not exist, skipping
> DROP SCHEMA
> CREATE SCHEMA
> btsnp=# \dn
> List of schemas
> Name | Owner
> --------------------+----------
> foo | faheem
> information_schema | postgres
> pg_catalog | postgres
> pg_toast | postgres
> pg_toast_temp_1 | postgres
> public | postgres
> (6 rows)
>
> On Wed, 7 Oct 2009, Faheem Mitha wrote:
>
>>
>> Hi,
>>
>> When running this function with postgresql 8.4 and sqla 0.5.5,
>>
>> def test(dbstring):
>> from sqlalchemy import create_engine
>> db = create_engine(dbstring)
>> conn = db.connect()
>> from sqlalchemy.sql import text
>> gq = text("""
>> SET search_path TO public;
>> DROP SCHEMA IF EXISTS foo CASCADE;
>> CREATE SCHEMA foo;
>> """)
>> conn.execute(gq)
>> conn.close()
>>
>> the schema foo is not created. However, removing the
>>
>> SET search_path TO public;
>>
>> line makes it work. This is not the case when issuing these commands
>> directly
>> via psql. Any idea what might be going on here?
>>
>> Regards, Faheem.
>>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" 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/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---