On Oct 9, 2009, at 7:35 PM, Faheem Mitha wrote:

> Can you explain why removing the "SET search_path TO public;" string
> makes a commit happen? You also say "that string you have will not
> trip off SQLA's "autocommit" feature." How does this autocommit
> feature work, and are there certain strings that will trigger an
> autocommit?

for textual statements, autocommit is applied when this regexp matches:

AUTOCOMMIT_REGEXP = re.compile(r'\s*(?:UPDATE|INSERT|CREATE|DELETE| 
DROP|ALTER)',
                                re.I | re.UNICODE)




>
>                                                     Regards, Faheem.
>
>> 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 sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to