Re: [sqlalchemy] alternate way to filter queries

2013-08-26 Thread Simon King
and intersects methods in the first example on http://docs.sqlalchemy.org/en/rel_0_8/orm/extensions/hybrid.html. Hope that helps, Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from

Re: [sqlalchemy] Updating a one-to-many relationship

2013-08-15 Thread Simon King
of all the [0] indexing and so on) Hope that helps, Simon On 15 Aug 2013, at 02:12, csdr...@gmail.com csdr...@gmail.com wrote: Simon, your idea about putting together a script is a good one. Please see the attached. I think all these errors are related but I'm scratching my head about what

Re: [sqlalchemy] Updating a one-to-many relationship

2013-08-14 Thread Simon King
] doesn't make any sense. Please try to create a self-contained script that demonstrates your problem. Here is a good example: https://groups.google.com/d/msg/sqlalchemy/jQtIRJXVfH8/LgwX-bomEIQJ Thanks, Simon On Wed, Aug 14, 2013 at 2:45 AM, csdr...@gmail.com wrote: I'm afraid there are still

Re: [sqlalchemy] self-referential many-to-many relationships and mixins

2013-08-13 Thread Simon King
#configuring-relationships Hope that helps, Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send

Re: [sqlalchemy] Creating one-to-many relationship: child class returns empty list after trying to enter data

2013-08-10 Thread Simon King
self.prices.append(prices) as the last line of your loop, it should all work. In fact, if you do that, the session.add will be unnecessary because the prices will be automatically added to the session (assuming that the company is already in the session). Hope that helps, Simon -- You received

Re: [sqlalchemy] Extending sqlalchemy.schema.Table

2013-08-01 Thread Simon King
each table in the metadata, setting the __class__ attribute to your subclass. Hope that helps, Simon On Thu, Aug 1, 2013 at 12:17 AM, Gustavo Baratto gbara...@gmail.com wrote: Thanks for the reply Michael... I had a hunch this wouldn't be easy to tackle, but this is more than I can chew

Re: [sqlalchemy] filtering by variable attribute names

2013-07-23 Thread Simon King
, attr)=='bar').all() Hope that helps, Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send

Re: [sqlalchemy] Generated update command is alway schosing alternative field names

2013-07-11 Thread Simon King
://www.sqlalchemy.org/trac/wiki/UsageRecipes/BindsAsStrings Hope that helps, Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com

Re: [sqlalchemy] [psql] string escaping quirk in like clauses

2013-06-28 Thread Simon King
On Fri, Jun 28, 2013 at 2:11 AM, Burak Arslan burak.ars...@arskom.com.tr wrote: On 06/27/13 13:41, Simon King wrote: Remember that Python also has its own string escaping. When you write a literal '\\' in Python, you are creating a string containing a single backslash. Hi Simon, I'm aware

Re: [sqlalchemy] [psql] string escaping quirk in like clauses

2013-06-28 Thread Simon King
On Fri, Jun 28, 2013 at 11:05 AM, Burak Arslan burak.ars...@arskom.com.tr wrote: On 06/28/13 11:55, Simon King wrote: When you write this: e.execute(t.select(t.c.a.like('\\'))) ...the pattern that you are sending to SA is a single backslash, and SA is forwarding that directly to PG. What do

Re: [sqlalchemy] [psql] string escaping quirk in like clauses

2013-06-27 Thread Simon King
to pass 2 backslashes to PG, you either need to use 4 slashes in Python (), or use a raw string (r\\) print '\\' \ print '' \\ print r'\\' \\ Hope that helps, Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from

Re: [sqlalchemy] How to update PickleType column using DBSession.execute()

2013-05-31 Thread Simon King
the documentation at: http://docs.sqlalchemy.org/en/rel_0_8/orm/session.html#sqlalchemy.orm.session.Session.execute Hope that helps, Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from

Re: [sqlalchemy] sqlite and max_overflow

2013-05-28 Thread Simon King
I think turbogears is loading your sqlalchemy parameters from a config file (dev.cfg perhaps?). You should look for a line of the form sqlalchemy.max_overflow = X and delete it. Hope that helps, Simon On Tue, May 28, 2013 at 10:34 AM, jo jose.soa...@sferacarta.com wrote: Thanks for the tip

Re: [sqlalchemy] Are consecutive query.get calls supposed to send a single SELECT query?

2013-05-21 Thread Simon King
(Descriptiontype).get(-2147483648) d2 = session.query(Descriptiontype).get(-2147483648) d3 = session.query(Descriptiontype).get(-2147483648) assert (d1 is d2) and (d2 is d3) Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from

Re: [sqlalchemy] EAV Optimizations

2013-05-16 Thread Simon King
code to maintain. I'm not sure about the performance yet - some of the queries feel slower than I think they should, but I haven't looked into it properly yet. Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group

Re: [sqlalchemy] tablet version cache

2013-05-09 Thread Simon King
/var/cache/sorcery/x86_64/libxslt-1.1.28-x86_64-pc-linux- gnu.tar.bz2 Finished processing install requests. I think you're on the wrong mailing list... This is SQLAlchemy (www.sqlalchemy.org). I guess you're talking about http://www.sourcemage.org/? Simon -- You received this message because

Re: [sqlalchemy] Using UniqueConstraint or unique=True

2013-05-03 Thread Simon King
at http://docs.sqlalchemy.org/en/rel_0_8/orm/extensions/declarative.html#table-configuration. Note that __table_args__ here is a 1-element tuple - the comma on the end of the line is important. Hope that helps, Simon -- You received this message because you are subscribed to the Google Groups

Re: [sqlalchemy] Testing sqlalchemy applications

2013-04-23 Thread Simon King
for multiple tests, is to create a setup function. I see py.test has a number of options for doing this: http://pytest.org/latest/xunit_setup.html#xunitsetup http://pytest.org/latest/fixture.html Hope that helps, Simon -- You received this message because you are subscribed to the Google

Re: [sqlalchemy] Testing sqlalchemy applications :p:

2013-04-23 Thread Simon King
On Tue, Apr 23, 2013 at 2:08 PM, Paradox para...@pobox.com wrote: On 04/23/2013 04:31 PM, Simon King wrote: On Tue, Apr 23, 2013 at 6:54 AM, Paradox para...@pobox.com wrote: I have a question related to sqlalchemy and testing, not sure if this is the best place to ask so let me know if I

Re: [sqlalchemy] How to map a oracle table with long table name

2013-04-17 Thread Simon King
. Hope that helps, Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy

Re: [sqlalchemy] Re: views declarative?

2013-04-17 Thread Simon King
Base to a Table? I have been unsuccessful in bridging the two. Set __table__ to your Table instance: http://docs.sqlalchemy.org/en/rel_0_8/orm/extensions/declarative.html#using-a-hybrid-approach-with-table Simon -- You received this message because you are subscribed to the Google Groups

Re: [sqlalchemy] implementing one-to-many relationship?

2013-04-15 Thread Simon King
://docs.sqlalchemy.org/en/rel_0_8/orm/relationships.html#configuring-how-relationship-joins, SA 0.8 should be able to handle this just by specifying the foreign_keys parameter: first_heartbeat = relationship('Heartbeat', foreign_keys=[first_heartbeat_id]) Hope that helps, Simon -- You received this message

Re: [sqlalchemy] complex many to many relationship

2013-03-27 Thread Simon King
a bit harder. You'll probably want to map a class to the Reference_Assoc table (optionally using single-table inheritance so that you have a subclass per type_key) Hope that helps, Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe

Re: [sqlalchemy] joinedload + limit

2013-03-21 Thread Simon King
relationships. Something like: p = db.query(Profile).join(City).options(contains_eager('city')).filter_by(id=p.id).limit(1).one() I think you need to spell out each join individually - I don't think there's a way to say 'join to all relationships' Hope that helps, Simon -- You received this message

Re: [sqlalchemy] SA connect to database remotely

2013-03-13 Thread Simon King
know about it. Thanks very much for you input! LYH Can you connect using the mysql client directly? What happens when you run this: mysql -u root -p -h 10.7.0.127 dbname Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe

Re: [sqlalchemy] Updating a table using sqlalchemy.sql.expression update

2013-03-07 Thread Simon King
This is an unusual way to update an object that you've already retrieved: result = session.query(Executions). \ filter_by(id=execution_id).first() if result.end_date is None: e = update(Executions).where(Executions.id==bindparam(execution_id)). \

Re: [sqlalchemy] How Can I Build a ForeignKey to a Table Which Has Multiple Primary Keys?

2013-03-07 Thread Simon King
requires that the primary key uniquely identifies the row in the database. Simon On Thu, Mar 7, 2013 at 2:00 AM, Randall Degges rdeg...@gmail.com wrote: Hi Mike, Sorry about that, I actually had a typo there. I've got a correct code sample available here http://stackoverflow.com/questions

Re: [sqlalchemy] Updating a table using sqlalchemy.sql.expression update

2013-03-07 Thread Simon King
of these directly like Files.id. If you ever need access to the underlying Table object, you can get it from Files.__table__. When using things like session.query(), you can often use tables or mapped classes interchangeably. Hope that helps, Simon On 7 Mar 2013, at 20:57, Mauricio de Abreu

Re: [sqlalchemy] How Can I Build a ForeignKey to a Table Which Has Multiple Primary Keys?

2013-03-07 Thread Simon King
( ['exchange_exchange', 'exchange_area_code_pk'], ['exchange.exchange', 'exchange.area_code_pk'], ), ) Simon On 7 Mar 2013, at 23:49, Randall Degges rdeg...@gmail.com wrote: Hi Lloyd, Thank you! I believe this is what I

Re: [sqlalchemy] How Can I Build a ForeignKey to a Table Which Has Multiple Primary Keys?

2013-03-07 Thread Simon King
According to the pastie log, your table is called exchanges, not exchange, so the target columns should be called exchanges.exchange and exchanges.area_code_pk. Simon On 8 Mar 2013, at 00:27, Randall Degges rdeg...@gmail.com wrote: Hi Simon, Ok cool. So, I updated that, but now I'm

Re: [sqlalchemy] Storing and Retrieving BLOB in SqlAlchemy

2013-02-27 Thread Simon King
are using, but in pyramid I think you would set the response.body attribute to your contentstr, rather than returning it. Does that make any difference? Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop

Re: [sqlalchemy] is there a more proper way to chain dynamic or clauses ?

2013-02-22 Thread Simon King
subjective, but I find that easier to read. You can also use and | but I think you have to be a little careful with operator precedence. You can probably write this: ands.append((Useraccount.gender == gender) (Useraccount.age == age)) Simon -- You received this message because you

Re: [sqlalchemy] Proper way to do processing across entire db?

2013-02-21 Thread Simon King
, Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com

Re: [sqlalchemy] Low performance when reflecting tables via pyodbc+mssql

2013-02-12 Thread Simon King
, dbmeta, autoload=True, autoload_with=dbengine) If you add echo='debug' to your create_engine call, SA will log all calls to the database and rows returned, which might give you an idea of where all the time is being spent. Hope that helps, Simon -- You received this message because you

Re: [sqlalchemy] Low performance when reflecting tables via pyodbc+mssql

2013-02-12 Thread Simon King
On Tue, Feb 12, 2013 at 11:29 AM, shaung shaun.g...@gmail.com wrote: On Tuesday, February 12, 2013 7:18:37 PM UTC+9, Simon King wrote: If you add echo='debug' to your create_engine call, SA will log all calls to the database and rows returned, which might give you an idea of where all

Re: [sqlalchemy] updating with a Session ?

2013-02-06 Thread Simon King
/en/rel_0_8/orm/session.html#using-sql-expressions-with-sessions Hope that helps, Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr

Re: [sqlalchemy] updating with a Session ?

2013-02-06 Thread Simon King
On Wed, Feb 6, 2013 at 11:19 AM, Simon King si...@simonking.org.uk wrote: On Wed, Feb 6, 2013 at 2:05 AM, Jonathan Vanasco jonat...@findmeon.com wrote: I use SqlAlchemy in a Pyramid app. All my models, connections, etc are within and set up by Pyramid. I'm trying to do a maintenance script

Re: [sqlalchemy] query.filter AND ( ... OR ... OR ) how to?

2013-01-23 Thread Simon King
like this should do what you want: conditions = [] for jj in list(chunks(val, 5)): conditions.append(Azienda.c.id.in_( jj )) qry = qry.filter(sa.or_(*conditions)) Hope that helps, Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post

Re: [sqlalchemy] namedTuple with conflicting attributes

2013-01-18 Thread Simon King
should be able to do this: print sample[Sample.id] print sample[Experiment.id] Hope that helps, Simon -- 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

Re: [sqlalchemy] max() min() string lengths?

2013-01-04 Thread Simon King
(Word.word)), func.min(func.length(Word.word))).all() Hope that helps, Simon -- 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

Re: [sqlalchemy] [Q] Transform a select part of a query

2012-10-24 Thread Simon King
this work for you: def number_of_people_older_than(age) q = people_older_than(age) return q.count() See also http://docs.sqlalchemy.org/en/rel_0_7/orm/tutorial.html#counting Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post

Re: [sqlalchemy] Re: isolation level not supported on MySQL 3.23

2012-10-22 Thread Simon King
the server_version_info check (for version 4.0.3) made the problem go away. Cheers, Simon -- 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

Re: [sqlalchemy] Re: isolation level not supported on MySQL 3.23

2012-10-22 Thread Simon King
On Mon, Oct 22, 2012 at 3:29 PM, Simon King si...@simonking.org.uk wrote: On Tue, Sep 18, 2012 at 1:33 PM, Ids idsvandermo...@gmail.com wrote: and of course sqlalchemy 0.5.1 did work. So something in sqlalchemy 0.7.8 broke... I just hit this error myself when using the latest SQLAlchemy

Re: [sqlalchemy] SQLALCHEMY query.

2012-10-03 Thread Simon King
() are unnecessary - filtering a query already implies that you are AND-ing the condition with all the previous conditions) Simon -- 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

Re: [sqlalchemy] SQLALCHEMY query.

2012-10-03 Thread Simon King
On Wed, Oct 3, 2012 at 5:23 PM, Trinath Somanchi trinath.soman...@gmail.com wrote: Hi Simon- I have update my ORM query this way result = session.query(models.Instance.hostname.distinct(),models.FixedIp.address,models.VirtualInterface.address).\ join

Re: [sqlalchemy] live access to postgis database to use in ExtJS, OpenLayers, etc

2012-10-02 Thread Simon King
back, are completely outside the scope of this list and I'm afraid you are unlikely to find much help here with it. Sorry I can't be more help, Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy

Re: [sqlalchemy] Copying Between Databases - Can I modify part of a Composite Key?

2012-09-27 Thread Simon King
row. If (1, 4) is actually the new version of (1, 1), then I would say that your primary key should just be the acct_id column, not the pair of (acct_id, env_id). SA will then see them as the same row, and UPDATE rather than INSERT. Simon -- You received this message because you are subscribed

Re: [sqlalchemy] SQLAlchemy with Flask -- hybrid models?

2012-08-22 Thread Simon King
referenced above illustrates a command-line session using them, so there's no reason why you couldn't do the same in a worker process. Have you already tried it and found that it doesn't work? Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post

Re: [sqlalchemy] SQLAlchemy with Flask -- hybrid models?

2012-08-22 Thread Simon King
On Wed, Aug 22, 2012 at 2:44 PM, David McKeone davidmcke...@gmail.com wrote: On Wednesday, August 22, 2012 2:33:01 PM UTC+1, David McKeone wrote: On Wednesday, August 22, 2012 2:23:28 PM UTC+1, Simon King wrote: On Wed, Aug 22, 2012 at 12:51 PM, David McKeone davidm...@gmail.com wrote

Re: [sqlalchemy] Create tables from class declaration

2012-08-21 Thread Simon King
://docs.sqlalchemy.org/en/rel_0_7/orm/extensions/declarative.html#accessing-the-metadata Hope that helps, Simon -- 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

Re: [sqlalchemy] Re: how to get into PG database, is the url the right way? newbie question

2012-08-14 Thread Simon King
want to start with something smaller such as Flask. Hope that helps, Simon -- 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

Re: [sqlalchemy] Re: how to get into PG database, is the url the right way? newbie question

2012-08-14 Thread Simon King
On Tue, Aug 14, 2012 at 6:39 PM, Gery geryherb...@gmail.com wrote: Hello Simon, Thanks for your answer, acttually I don't use any web framework, I just did a html page and put Openlayers, GeoExt, and Ext code there. To display points/lines/polylines/rasters/etc., I use Mapserver, so I

Re: [sqlalchemy] keeping long filter statements easily readable?

2012-05-28 Thread Simon King
(sa.or_(dbObj.foo2 == 'abc', dbObj.foo3 == 'def')) .order_by(dbObj.foo2) .all()) Remember multiple filter clauses are automatically AND-ed together. Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post

Re: [sqlalchemy] Session management with mod_wsgi and webapp2

2012-05-28 Thread Simon King
using multiple processes with mod_wsgi? If so, remember that each process will have its own pool, so if you had 2 processes, you could have up to 30 connections open. Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send

Re: [sqlalchemy] Execute statement after each connect.

2012-05-14 Thread Simon King
#sqlalchemy.events.PoolEvents.connect 'connect' event handlers look like this: connect(dbapi_connection, connection_record) Can't you use the dbapi_connection to call your SQL function? Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email

Re: [sqlalchemy] Re: Working with large IN lists

2012-02-21 Thread Simon King
to build long lists of bindparam objects. I've no idea if this is still the case these days. The best thing you can do is just try it. Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy

Re: [sqlalchemy] Querying mssql time columns

2011-10-31 Thread Simon Haines
time.isoformat() in filter constraints. Hope that's portable to windows! Thanks (again) for your help--this is the second time you've helped me out here. Much appreciated. Simon. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To view this discussion

[sqlalchemy] Querying mssql time columns

2011-10-30 Thread Simon Haines
or later), and I have confirmed it emits the correct DDL but still treats all bound time values as DATETIMEs anyway. Is this a bug or am I missing something? Many thanks, Simon. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To view this discussion

Re: [sqlalchemy] Have I found a bug with MSSQL/PyODBC identity maps?

2011-10-11 Thread Simon Haines
- such as if the database returned a string 1, that would cause the get() above to not locate integer 1 in the cache. This was exactly the issue. Many thanks for your help with this--apologies for not getting back to you sooner. Simon. -- You received this message because you are subscribed

[sqlalchemy] Have I found a bug with MSSQL/PyODBC identity maps?

2011-10-06 Thread Simon Haines
and can't find anything that might affect this. Am I missing something? I'm going to dig into the session identity map code now to see what I can find, but I'd appreciate it if anyone already knows where I'm going wrong. Many thanks, Simon. -- You received this message because you

Re: [sqlalchemy] packages, modules and double imports - oh my!

2011-10-03 Thread Simon King
module that imports the first. This can then be run with python -m mypackage.main. This isn't so helpful if you were intending to have a number of modules that could be run independently. Perhaps you could live with something like python -m mypackage.main mod1 mod2 mod3? Hope that helps, Simon PS

RE: [sqlalchemy] Possible bug with subqueryload

2011-09-28 Thread King Simon-NFHD78
-Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalchemy@googlegroups.com] On Behalf Of Michael Bayer Sent: 27 September 2011 19:37 To: sqlalchemy@googlegroups.com Subject: Re: [sqlalchemy] Possible bug with subqueryload On Sep 27, 2011, at 1:16 PM, King Simon

Re: [sqlalchemy] Possible bug with subqueryload

2011-09-28 Thread Simon King
On Wed, Sep 28, 2011 at 2:15 PM, Michael Bayer mike...@zzzcomputing.comwrote: that mapper.order_by thing is fixed in 0.7.3/0.6.9 tip. Brilliant - thanks again for all the time you put in to SA and this group, Simon -- You received this message because you are subscribed to the Google Groups

[sqlalchemy] Possible bug with subqueryload

2011-09-27 Thread King Simon-NFHD78
in the main query. Cheers, Simon import sqlalchemy as sa import sqlalchemy.orm as saorm from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() class Master(Base): __tablename__ = 'master' id

RE: [sqlalchemy] Possible bug with subqueryload

2011-09-27 Thread King Simon-NFHD78
-Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalchemy@googlegroups.com] On Behalf Of Michael Bayer Sent: 27 September 2011 16:24 To: sqlalchemy@googlegroups.com Subject: Re: [sqlalchemy] Possible bug with subqueryload Hi Simon - yeah that looks pretty buglike

RE: [sqlalchemy] Bulk creation of columns

2011-09-22 Thread King Simon-NFHD78
. create_column isn't an SQLAlchemy method as far as I know. Are you using something like sqlalchemy-migrate (http://code.google.com/p/sqlalchemy-migrate/)? If so, you'll probably get more help on their mailing list. Hope that helps, Simon -- You received this message because you are subscribed

RE: [sqlalchemy] Re: Error while using CAST

2011-09-14 Thread King Simon-NFHD78
object table.c.empno instead Hope that helps, Simon pravin battula wrote Mike, when i execute the below sql statement directly in the database using sqlyog,it works fine but when tried with sqlalchemy it didn't. update mytable set EmpMaster = cast(empno as UNSIGNED INTEGER) On Sep 14, 8

RE: [sqlalchemy] data driven schema in sqlalchemy

2011-08-05 Thread King Simon-NFHD78
/sqlalchemy/file/3e75f284f253/examples/vertical I don't think it's exactly what you've described, but hopefully it's a starting point. Hope that helps, Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy

RE: [sqlalchemy] update existing row

2011-08-01 Thread King Simon-NFHD78
this (assuming MyMappedClass is the class mapped to MyTable): s = MyMappedClass query = self.session.query(s).filter(s.my_name == self.my_name) sts = query.first() sts.status = 'L' self.session.flush() Hope that helps, Simon -- You received this message because you are subscribed to the Google Groups

RE: [sqlalchemy] Updating records in table not working

2011-07-27 Thread King Simon-NFHD78
this? I *think* you should be able to use session.merge instead: http://www.sqlalchemy.org/docs/orm/session.html#merging temp = Item(item=itemno, ...) new = db.session.merge(temp) db.session.commit() (note that 'merge' returns a new object attached to the session) Hope that helps, Simon -- You

RE: RE: [sqlalchemy] Updating records in table not working

2011-07-27 Thread King Simon-NFHD78
UTC, Simon King wrote: I've looked at the SA documentation and as far as I can see the 'add' does an insert or an update. I think this is incorrect - 'add' always corresponds to 'INSERT' Only for brand new instances, not associated with a session. For *detached

RE: [sqlalchemy] engine.echo not working as expected

2011-07-27 Thread King Simon-NFHD78
it to echo. This is explained in the note at the bottom of http://www.sqlalchemy.org/docs/core/engines.html#configuring-logging. (not that that necessarily helps you, but it does at least say that it is expected behaviour) Simon -- You received this message because you are subscribed

RE: [sqlalchemy] how to get last record from a resultset

2011-07-20 Thread King Simon-NFHD78
. Simon -Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalchemy@googlegroups.com] On Behalf Of Krishnakant Mane Sent: 20 July 2011 15:16 To: sqlalchemy@googlegroups.com Cc: Timuçin Kızılay Subject: Re: [sqlalchemy] how to get last record from a resultset Well

RE: [sqlalchemy] Re: information about filed create_engine

2011-07-19 Thread King Simon-NFHD78
)))] start_response(status, response_headers) return [output] It would be worth comparing the output from that with the values of sys.prefix and sys.path when run from bottle. Hope that helps, Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy

RE: [sqlalchemy] Question about sqlalchemy inserts and deletes order in a transaction

2011-07-19 Thread King Simon-NFHD78
rows in Table B that reference them. However, I don't think it necessarily performs deletions before insertions. Simon -- 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

RE: [sqlalchemy] Re: information about filed create_engine

2011-07-18 Thread King Simon-NFHD78
framework are you using (if any)? It sounds like they are hampering your efforts to debug this. You might find it easier to run a very simple wsgi server such as the one in the wsgiref module: http://docs.python.org/library/wsgiref.html#module-wsgiref.simple_server Simon -- You received this message

RE: [sqlalchemy] Re: information about filed create_engine

2011-07-18 Thread King Simon-NFHD78
it is something like /var/log/httpd/error_log. Does that shed any light on the problem? Simon -- 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

RE: [sqlalchemy] Re: information about filed create_engine

2011-07-14 Thread King Simon-NFHD78
Eduardo wrote On Jul 13, 7:11 pm, King Simon-NFHD78 simon.k...@motorolasolutions.com wrote: Eduardo wrote Hi, I am trying to prompt an answer from a database after failed create_engine command. I searched through the source code and I found TypeError, and ValueError returns

RE: [sqlalchemy] Re: information about filed create_engine

2011-07-14 Thread King Simon-NFHD78
committed at the end of the web request, so any changes you've made are being discarded? Simon -- 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

RE: [sqlalchemy] Re: information about filed create_engine

2011-07-14 Thread King Simon-NFHD78
committed at the end of the web request, so any changes you've made are being discarded? Simon -- 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

RE: [sqlalchemy] Re: information about filed create_engine

2011-07-14 Thread King Simon-NFHD78
Eduardo wrote: On Jul 14, 10:49 am, King Simon-NFHD78 simon.k...@motorolasolutions.com wrote: Eduardo wrote When I use the same script with a standalone application it works but when I try to run it as a wsgi application it fails (wsgi logs does not contain any information

RE: [sqlalchemy] information about filed create_engine

2011-07-13 Thread King Simon-NFHD78
, and if so, can you show us the traceback? Simon -- 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

RE: [sqlalchemy] relationship problem

2011-07-12 Thread King Simon-NFHD78
://www.sqlalchemy.org/docs/orm/relationships.html#one-to-many) Hope that helps, Simon -- 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

RE: [sqlalchemy] In case of joinedload_all how do I order by on a columns of those relations

2011-06-29 Thread King Simon-NFHD78
/trac/wiki/FAQ) Hope that helps, Simon -- 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

RE: [sqlalchemy] (OperationalError) (1066, Not unique table/alias: '...') when selecting only from a joined table

2011-06-28 Thread King Simon-NFHD78
in the repository, but the website is so convenient...) Cheers, Simon -- 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

RE: [sqlalchemy] dynamically set table_name at runtime

2011-06-21 Thread King Simon-NFHD78
): class Feature(Base, GeometryTableMixIn): __table__ = tablename # etc. return Feature ...but the whole thing feels strange. What are you actually trying to do? Cheers, Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group

RE: [sqlalchemy] Accessing several databases

2011-06-16 Thread King Simon-NFHD78
= saorm.Session(bind=self.engine) def get_item(self, id): return self.session.query(ProjectItem).get(id) Hope that helps, Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy

RE: [sqlalchemy] mapping a class linked with two other classes (AttributeError: 'str' object has no attribute '_sa_instance_state')

2011-06-16 Thread King Simon-NFHD78
= ArkUserContactGUID(google_UID=entry.get_id()) data.google_UID.append(obj) (If I've misunderstood your mapping, these class names are probably wrong) Hope that helps, Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group

RE: [sqlalchemy] General questions of a newbee

2011-06-15 Thread King Simon-NFHD78
in the session. I hope that helps, Simon -- 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

RE: [sqlalchemy] db name from session?

2011-06-15 Thread King Simon-NFHD78
): http://www.sqlalchemy.org/docs/orm/session.html#sqlalchemy.orm.session.S ession.get_bind ...but even then, I'm not sure you can necessarily go from an engine to a db name. What do you even mean by db name? Schema name? Host? Dialect? Filename? Simon -- You received this message because you

RE: [sqlalchemy] question re using the session object

2011-06-14 Thread King Simon-NFHD78
) Use your Session directly - it implements the same interface as the real session, and forwards all requests on to the underlying thread-local session. Hope that helps, Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group

RE: [sqlalchemy] Re: Trying to query a relationship of a relationship

2011-06-09 Thread King Simon-NFHD78
that helps, Simon -- 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

RE: [sqlalchemy] Filtered backref

2011-06-09 Thread King Simon-NFHD78
( TagAssociation, primary_join=(sa.and_(id == TagAssociation.post_id, owner_id == TagAssociation.owner_id))) I think you would have to treat this relationship as readonly, so you might need/want to add viewonly=True. Hope that helps, Simon -- You received

RE: [sqlalchemy] Appending a where clause to a query

2011-04-27 Thread King Simon-NFHD78
(t_posts.c.created_atend_date) Hope that helps, Simon -- 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

RE: [sqlalchemy] Best design for commits?

2011-04-20 Thread King Simon-NFHD78
orm_obj.id after Session.commit() will trigger another (possibly unnecessary) query to the database. Hope that helps, Simon -- 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

RE: [sqlalchemy] API that allows me to do additional database operations just before insert execution for SQL Expression

2011-04-19 Thread King Simon-NFHD78
, there is a 'before_execute' event which you could listen for, and look for INSERT clauses. If you can't upgrade to 0.7, you might be able to use a ConnectionProxy: http://www.sqlalchemy.org/docs/07/core/interfaces.html Hope that helps, Simon -- You received this message because you are subscribed

RE: [sqlalchemy] Re: Context based execution

2011-04-15 Thread King Simon-NFHD78
, Simon -- 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

RE: [sqlalchemy] Create a one-to-many relationship using association object with two foreign key primary keys

2011-04-14 Thread King Simon-NFHD78
('repo_id', Integer, ForeignKey('package_repo.repo_id'), Column('msg',String)) I *think* SA will automatically work out the relationship condition based on those two foreign keys. Hope that helps, Simon package_repo_table = Table('package_repo', metadata, Column('package_id',Integer

RE: [sqlalchemy] Two Objects, One Table and the inverse

2011-04-05 Thread King Simon-NFHD78
wrapper for the Address class that adds the join condition into any attribute comparison operations. Good idea, or silly idea? (Or perhaps it already works...) Simon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email

RE: [sqlalchemy] Re: sqlalchemy.exc.NoReferencedTableError: Could not find table with which to generate a foreign key

2011-03-30 Thread King Simon-NFHD78
is importing the submodules inside the myapp/models/__init__.py Hope that helps, Simon -Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalchemy@googlegroups.com] On Behalf Of eric cire Sent: 30 March 2011 14:57 To: sqlalchemy Subject: [sqlalchemy] Re

<    2   3   4   5   6   7   8   9   10   >