[sqlalchemy] Re: Import problem

2007-09-21 Thread Goutham Lakshminarayan
Bingo! easy_install -u sqlalchemy worked.
(Btw wouldn't mind knowing what was wrong wen i first installed it :O. The
folder wasnt empty and easy_install.pth did have a refernece to the egg).
Thnx a lot!

regards

Goutham

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Auto load problem with SQLAlchemy 0.3.10 and mySQL

2007-09-21 Thread jason kirtland

Noufal wrote:
 On Sep 20, 10:34 pm, Noufal [EMAIL PROTECTED] wrote:
 [..]
 I create the tables using SQLAlchemy.  I'll send you the output in a
 day, I'm away from the machine where this code is right now.
 
 The output of the create table column looks like this
 
 CREATE TABLE `stats` (
   `sid` int(11) NOT NULL auto_increment,
   `rid` int(11) default NULL,
   `stagename` varchar(50) default NULL,
   `description` varchar(250) default NULL,
   `starttime` timestamp NOT NULL default CURRENT_TIMESTAMP on update
 CURRENT_TIMESTAMP,
   `endtime` timestamp NOT NULL default '-00-00 00:00:00',
   PRIMARY KEY  (`sid`)
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1

The MyISAM storage engine doesn't retain foreign key information- to 
autoload FKs you must create the table with a storage engine that 
supports FKs such as InnoDB.  That looks like:

Table('stats', metadata, ..columns.., mysql_engine='InnodB')

You can also use ALTER TABLE via mysql to change the storage engine and 
add foreign keys if you've already got these MyISAM tables in production 
(see the mysql docs.)

Supplying an explicit ForeignKeyConstraint clause for an autoloaded 
MyISAM table is just fine too, if you want to keep using that storage 
engine.

Cheers,
Jason

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Built-in escape function?

2007-09-21 Thread Paul Johnston
Hi,

It doesn't, and that would be a reasonable addition.

I'm also thinking that startswith, endswith and contains should probably do
the escaping by default.

If you create a ticket I'll look at it sometime, although not for a couple
of weeks (I'm on holiday, woo :-)

Paul


On 9/21/07, Felix Schwarz [EMAIL PROTECTED] wrote:


 Hi,

 as several nice people from this list told me, SQLAlchemy uses bound
 parameters by default so that ordinary SQL injections are not possible
 anymore.

 However, I want to escape search patterns in like-queries, e.g.:
 User.c.username.like('%' + userinput + '%')

 Of course, I can write my own function to escape all pattern characters
but as always it seems to be more secure to use existing functions.
 After looking at the documentation for SQLAlchemy 0.3.10, I did not find
 an escape function.

 So just a quick question: Does SQLAlchemy come with a function to escape
patterns?

 thank you very much
 fs


 


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Built-in escape function?

2007-09-21 Thread Felix Schwarz

Hi,

Paul Johnston wrote:
 If you create a ticket I'll look at it sometime, although not for a 
 couple of weeks (I'm on holiday, woo :-)

[x] done, http://www.sqlalchemy.org/trac/ticket/791

fs


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Elixir

2007-09-21 Thread Gaetan de Menten

On 9/20/07, Christine [EMAIL PROTECTED] wrote:

 Any elixir fans? Any idea on when it will finally be made an
 extension? Let me know.

Not sure. I'd like to answer: When it's ready. But ven when it'll be
ready, this might not happen. There would be some positive points to
that, but also some negative ones, so I guess we'll have to discuss
this with the community for more insight on that issue.

 PS: Here's a decent resource I like http://elixir.ematia.de/

This is the official Elixir website... ;-)

-- 
Gaƫtan de Menten
http://openhex.org

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] 0.4.0beta5 breaks [Oracle] query, works on 0.3.7 and with cxOracle

2007-09-21 Thread m h

Ok, so this looks impossible to me, but it's happening.  I figure
people with more experience debugging SA might be able to help.

I've got a generated query (no ORM).  I was using 0.3.7 with no
problems, but thought I'd give .4 a try to see if I can take advantage
of performance improvements.  From reading the migration documentation
it appeared all I really needed to do was change::

 meta = BoundMetaData(engine)

to::

 meta = MetaData(engine)

So I did that and now when I run my query now it throws an error::

...

File 
/home/matt/work/vpython/lib/python2.4/site-packages/SQLAlchemy-0.4.0beta5-py2.4.egg/sqlalchemy/engine/base.py,
line 867, in _cursor_execute
raise exceptions.DBAPIError.instance(statement, parameters, e)
sqlalchemy.exceptions.DatabaseError: (DatabaseError) ORA-00932:
inconsistent datatypes: expected NUMBER got CLOB

In my log file, it appears that the statement generated for 0.3.7 and
0.4.0beta5 is the same.  The parameters differ a little.  One key is
somehow converted (incorrectly) to a float instead of a string (like
it was in 0.3.7).  I thought that might be the problem, but that is
the opposite of what the error message is.

So after digging/stepping through SA for a bit (hey, at least I
learned how to use pdb from emacs!), I didn't see anything useful.
Then I tried running the query using only cx_Oracle.  I used the same
statement and parameter from the 0.4.beta5 version and lo and behold,
it worked!?!?!  (I even changed the parameter that was a float to a
string and it still worked...)

So now I'm just confused.  I'm not sure how the same query can work
from straight cx_Oracle, but fails with the _CursorFairy tries to
execute it...  Has something/much changed with Oracle since 0.3.7 (I
know it's ~6 months old)?  The Changelog [0] lists oracle
improvements in beta2, auto_convert_lobs in 0.3.9  Could these
be responsible?

Any hints or suggestions would be great!  Thanks much.  I'm just
confused right now, and would like to leave that state ;)

-matt

0 - http://www.sqlalchemy.org/trac/browser/sqlalchemy/trunk/CHANGES

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Auto load problem with SQLAlchemy 0.3.10 and mySQL

2007-09-21 Thread Noufal

 The MyISAM storage engine doesn't retain foreign key information- to
 autoload FKs you must create the table with a storage engine that
 supports FKs such as InnoDB.  That looks like:

 Table('stats', metadata, ..columns.., mysql_engine='InnodB')

 You can also use ALTER TABLE via mysql to change the storage engine and
 add foreign keys if you've already got these MyISAM tables in production
 (see the mysql docs.)

Thanks Jason. The concept of which engine mySQL was using didn't come
into my head. i just used the default.

 Supplying an explicit ForeignKeyConstraint clause for an autoloaded
 MyISAM table is just fine too, if you want to keep using that storage
 engine.

This is what I've done right now.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: 0.4.0beta5 breaks [Oracle] query, works on 0.3.7 and with cxOracle

2007-09-21 Thread m h

Just for kicks I tried using .3.10 and it failed giving the same error
that was reported in the Aug 18 thread autoloading Oracle tables with
column defaults::

File 
/home/matt/work/vpython/lib/python2.4/site-packages/SQLAlchemy-0.3.10-py2.4.egg/sqlalchemy/databases/oracle.py,
line 117, in convert_result_value
return value.read()
AttributeError: 'str' object has no attribute 'read'

I can stay with .3.7, but I'm just wondering what the deal is with beta5.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: session.dirty, not behaving as I expected...

2007-09-21 Thread Michael Bayer


On Sep 20, 2007, at 12:55 PM, Alexandre Conrad wrote:

 It turns out that even if the values were kept unchanged, the slot  
 get's
 ditry. Of course, I'd understand that as soon as the setattr() is  
 called
 against the slot, it automaticly gets dirty regardless of the  
 replaced data.

it shouldnt.  dirty changes are based on a comparison of the new  
value being different from the old value.   send me a short test  
script (since im catching up on 500 emails...also what SA version ?)


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---