[sqlalchemy] Tool to check whether DB matches model

2007-01-28 Thread Paul Johnston
Hi, Is there a tool to check whether the DB matches the model? Something like SQLObject's status command. I'm sure I noticed something along these lines on the site, that even did rudimentary automatic alter table commands, but I can't find it now! Paul

[sqlalchemy] Re: polymorphic mapping with more than 2 level of inheritance

2007-01-28 Thread sdobrev
So, ive been working on this crapola pretty much all day... WAW! hey, don't overdose... (YOURE WELCOME) ... Hhmm. i don't believe in virtual beers, so maybe, treat you with this? http://www.giovannisample.com/media/mondo/Mondovision640.zip and the latest is in a branch

[sqlalchemy] Re: polymorphic mapping with more than 2 level of inheritance

2007-01-28 Thread Michael Bayer
all tests pass with rev 2267 of that branch. try that rev specifically, since i want to take whats there and do another pass. im trying to get it so that the entire science of parent table, child table, polymorphic selectables, primary join - polymorphic joins - determine direction/lazy

[sqlalchemy] Re: polymorphic mapping with more than 2 level of inheritance

2007-01-28 Thread sdobrev
all tests pass with rev 2267 of that branch. try that rev specifically, since i want to take whats there and do another pass. im trying to get it so that the entire science of parent table, child table, polymorphic selectables, primary join - polymorphic joins - determine direction/lazy

[sqlalchemy] Re: Tagging example

2007-01-28 Thread Damjan
I'm a SA newbie, so bare with me :) This is the SQL query for a tag cloud, returning each tag_name and it's weight (the count of page tagged with this tag). SELECT tag_name, COUNT(page_id) AS quantity FROM pages_tags JOIN tags USING (tag_id) GROUP BY tags.tag_id ORDER BY quantity

[sqlalchemy] Re: polymorphic mapping with more than 2 level of inheritance

2007-01-28 Thread Michael Bayer
clear_mappers() engine.dispose() let sessions and mapped objects fall out of scope ...and thats pretty much it. however, you really shouldnt be opening up a brand new sqlite:// connection for every test. you should be using the same engine for the whole program, and just do a

[sqlalchemy] Re: Tool to check whether DB matches model

2007-01-28 Thread Michael Bayer
you might be thinking of migrate (http://trac.erosson.com/migrate ) but thats not exactly what you describe here. (i dont actually know what SO's status command does). On Jan 28, 4:58 am, Paul Johnston [EMAIL PROTECTED] wrote: Hi, Is there a tool to check whether the DB matches the model?

[sqlalchemy] An assign_mapper question

2007-01-28 Thread avegas
Hello folks, I'm playing around with using assign_mapper inside of a Turbogears projects, and I ran into a small problem. My assign_mappers work fine for taking things out of the database, but if I pull an object out, and add a pre-existing element(say a user to a session) to a relation and

[sqlalchemy] [Solved] Avoiding SQL injection with raw-ish queries (MySQL FULLTEXT search)

2007-01-28 Thread Chris Shenton
I finally discovered the Using Bind Parameters in Text Blocks section of the SQLAlchemy manual -- very useful and very easy to use. Perhaps this will help others who are trying to search against MySQL's FULLTEXT index safely. FWIW, I'm doing this in Pylons. Here's what I ended up doing: t

[sqlalchemy] Help me catching a SQLError IntegrityError bij using try and except

2007-01-28 Thread ken.riel
Hello, I have a problem catching a sqlalchemy error in a try and expect. You see in the model that my user_name must be unique. So if the is a user_name like Ken and i fill in my form the name Ken for user_name i will get an error like this: SQLError: (IntegrityError) column user_name is not

[sqlalchemy] Column and business object verification??

2007-01-28 Thread chris e
I am planning on using sqlalchemy to build the api for a database I am developing, and I was wondering if there is any type of column verification that occurs before database commit. I.E.: a string column with length 40 would throw a verification exception if a value longer that 40 characters

[sqlalchemy] Avoiding SQL injection with raw-ish queries (MySQL FULLTEXT search)

2007-01-28 Thread Chris Shenton
I'm doing a query against a MySQL table that has a column which has a fulltext index, so I need to do some raw-ish queries. Problem is that these open me up to SQL injection attacks. How do I avoid them -- bound variables? filtering of quotes and funny chars? I create the index on a table

[sqlalchemy] Re: Column and business object verification??

2007-01-28 Thread Michael Bayer
On Jan 24, 1:50 am, chris e [EMAIL PROTECTED] wrote: I am planning on using sqlalchemy to build the api for a database I am developing, and I was wondering if there is any type of column verification that occurs before database commit. I.E.: a string column with length 40 would throw a

[sqlalchemy] Re: Help me catching a SQLError IntegrityError bij using try and except

2007-01-28 Thread Michael Bayer
my apologies as this email was caught in the spam filter for a few days (along with seven others...). i dont know turbogears but your code looks fine to me, a try/except around the flush() should catch any issues within. On Jan 26, 5:07 pm, ken.riel [EMAIL PROTECTED] wrote: Hello, I have

[sqlalchemy] Re: An assign_mapper question

2007-01-28 Thread Michael Bayer
On Jan 28, 12:37 am, avegas [EMAIL PROTECTED] wrote: I'm playing around with using assign_mapper inside of a Turbogears projects, and I ran into a small problem. My assign_mappers work fine for taking things out of the database, but if I pull an object out, and add a pre-existing

[sqlalchemy] working with multiple databases

2007-01-28 Thread Max Ischenko
Hello, I'm struggling to setup SA/Pylons for a multidatabase env without much luck. As far as I understand, I need a session per database. In Pylons, I get it for free via session_context binding. In other words, I have setup a session_context object for each of the database I need to work