well if its echoing, its definitely going in. its possible you
might need a "commit" afterwards (the engine does "autocommit" for
most write operations if a transaction is not in session, but "ALTER"
is not one of the keywords it looks for).
try running your operation through a transaction instead:
conn = engine.connect()
trans = conn.begin()
conn.execute("ALTER TABLE ....")
trans.commit()
as most of my experience is with oracle, im not accustomed to ALTER
statements needing a COMMIT.
On Sep 4, 2006, at 11:46 AM, Enrico Morelli wrote:
> On Mon, 4 Sep 2006 11:18:33 -0400
> Michael Bayer <[EMAIL PROTECTED]> wrote:
>
>> that should work fine, add "echo=True" to your create_engine() call
>> and it will show you all the SQL being issued.
>>
>
> Infact, using echo=True I see:
>
> In [75]:engine.execute('ALTER TABLE planning_set_2006 ADD COLUMN
> av1000
> VARCHAR(50)')
> [2006-09-04 17:44:30,941] [engine]: ALTER TABLE planning_set_2006 ADD
> COLUMN av1000 VARCHAR(50)
> [2006-09-04 17:44:30,941] [engine]: None
> Out[75]:<sqlalchemy.engine.base.ResultProxy instance at 0xb77dbfcc>
>
> And nothing happens in the database.
>
>> On Sep 4, 2006, at 10:03 AM, Enrico Morelli wrote:
>>
>>> Another question,
>>>
>>> why when I try to use engine.execute() to alter a table nothing
>>> happens?
>>>> From a program that I'm writing doesn't works, so I had try by
>>>> hand from
>>> a python shell, but nothing happen also.
>>>
>>> from sqlalchemy import *
>>>
>>> engine=create_engine('postgres://[EMAIL PROTECTED]/NMR2')
>>> metadata=BoundMetaData(engine)
>>> session=create_session()
>>> t='mytable'
>>> c='mycolumn'
>>> engine.execute('ALTER TABLE %s ADD COLUMN %s VARCHAR(50)' % (t, c))
>>>
>>>
>>> I use psql to see the result, but nothing happen.
>>>
>>> Excuse me for this stupid question but I'm unable to solve it.
>>>
>>>
>>> --
>>> -------------------------------------------------------------------
>>> (o_
>>> (o_ //\ Coltivate Linux che tanto Windows si pianta da solo.
>>> (/)_ V_/_
>>> +------------------------------------------------------------------+
>>> | ENRICO MORELLI | email: [EMAIL PROTECTED] |
>>> | * * * * | phone: +39 055 4574269 |
>>> | University of Florence | fax : +39 055 4574253 |
>>> | CERM - via Sacconi, 6 - 50019 Sesto Fiorentino (FI) - ITALY |
>>> +------------------------------------------------------------------+
>>>
>>> --------------------------------------------------------------------
>>> --
>>> ---
>>> Using Tomcat but need to do more? Need to support web services,
>>> security?
>>> Get stuff done quickly with pre-integrated technology to make your
>>> job easier
>>> Download IBM WebSphere Application Server v.1.0.1 based on Apache
>>> Geronimo
>>> http://sel.as-us.falkag.net/sel?
>>> cmd=lnk&kid=120709&bid=263057&dat=121642
>>> _______________________________________________
>>> Sqlalchemy-users mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users
>>
>>
>> ---------------------------------------------------------------------
>> ----
>> Using Tomcat but need to do more? Need to support web services,
>> security? Get stuff done quickly with pre-integrated technology to
>> make your job easier Download IBM WebSphere Application Server
>> v.1.0.1 based on Apache Geronimo
>> http://sel.as-us.falkag.net/sel?
>> cmd=lnk&kid=120709&bid=263057&dat=121642
>> _______________________________________________ Sqlalchemy-users
>> mailing list [email protected]
>> https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users
>
>
> --
> -------------------------------------------------------------------
> (o_
> (o_ //\ Coltivate Linux che tanto Windows si pianta da solo.
> (/)_ V_/_
> +------------------------------------------------------------------+
> | ENRICO MORELLI | email: [EMAIL PROTECTED] |
> | * * * * | phone: +39 055 4574269 |
> | University of Florence | fax : +39 055 4574253 |
> | CERM - via Sacconi, 6 - 50019 Sesto Fiorentino (FI) - ITALY |
> +------------------------------------------------------------------+
>
> ----------------------------------------------------------------------
> ---
> Using Tomcat but need to do more? Need to support web services,
> security?
> Get stuff done quickly with pre-integrated technology to make your
> job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache
> Geronimo
> http://sel.as-us.falkag.net/sel?
> cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Sqlalchemy-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users