Re: [sqlalchemy] SQL join between two tables from two databases

2015-01-20 Thread Brian Glogower
I am using MySQL On 17 January 2015 at 04:06, Thierry Florac tflo...@gmail.com wrote: What database server do you use? 2015-01-17 0:49 GMT+01:00 Brian Glogower bglogo...@ifwe.co: Hi all, I am trying to do a join between two tables, each residing on a separate databases. Here

Re: [sqlalchemy] SQL join between two tables from two databases

2015-01-20 Thread Brian Glogower
On 19 January 2015 at 08:01, Jonathan Vanasco jonat...@findmeon.com wrote: I haven't seen anyone bring this up before. If you get stuck and no better answer shows up here... I'd try just having a single session with tables from both DBs in it, and using raw SQL to populate the ORM objects --

[sqlalchemy] SQL join between two tables from two databases

2015-01-16 Thread Brian Glogower
/msg14445.html, but there wasn't enough details for me to get it working (I am a sqlalchemy novice). Is what I want to do even possible with sqlalchemy? Thanks, Brian -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group

[sqlalchemy] Re: When to use .cte(), .alias(), or .subquery() in a UNION of CTEs

2014-12-19 Thread Brian Findlay
Thanks, Jonathan. I must have read your earlier post a dozen times, and it certainly pointed me in the right direction -- at least, enough to get my query working. I'm going to study your test a bit -- thanks for posting it. -- You received this message because you are subscribed to the

Re: [sqlalchemy] Row level permissions

2014-09-22 Thread Brian the Lion
All, Sorry to resurrect a long-dead thread here, but this seems to have been left dangling precariously close to becoming productive. ;-) Seriously, though, there have been a couple https://groups.google.com/forum/#!searchin/sqlalchemy/security/sqlalchemy/Vl7CvEgVm9c/wK5ljrQ7z4cJ of

Re: [sqlalchemy] Deferring a many-to-many mapping

2014-09-15 Thread Brian Rossa
: On Sep 12, 2014, at 8:46 PM, Brian the Lion brian.ro...@gmail.com wrote: Hi all, I am having trouble deferring a many-to-many mapping. I just had a couple of questions related there-to: (1) The most visible implementations of vanilla many-to-many mappings seem to use sqlalchemy.Table

[sqlalchemy] Deferring a many-to-many mapping

2014-09-12 Thread Brian the Lion
Hi all, I am having trouble deferring a many-to-many mapping. I just had a couple of questions related there-to: (1) The most visible implementations of vanilla many-to-many mappings seem to use sqlalchemy.Table(...). Is that, indeed, the accepted practice? One alternative would be to use a

[sqlalchemy] Bound parameter on Postgres/psycopg2 Range data types

2014-07-10 Thread Brian Findlay
With the following model, I can currently set postgres range data types in 2 ways: *Model:* from sqlalchemy.dialects.postgresql import INT4RANGE class Foo(Base): __tablename__ = 'foo' id = Column(Integer, primary_key=True) bar = Column(INT4RANGE) *Method #1 - as string data type:*

[sqlalchemy] Re: Bound parameter on Postgres/psycopg2 Range data types

2014-07-10 Thread Brian Findlay
import INT4RANGE from psycopg2.extras import NumericRange Base = declarative_base() class Foo(Base): __tablename__ = 'foo' id = Column(Integer, primary_key=True) range = Column(INT4RANGE) e = create_engine(postgresql://brian@10.0.1.10:5432/test, echo=True) Base.metadata.create_all(e

Re: [sqlalchemy] Re: Bound parameter on Postgres/psycopg2 Range data types

2014-07-10 Thread Brian Findlay
): __tablename__ = 'foo' id = Column(Integer, primary_key=True) intrange = Column(INT4RANGE) numrange = Column(NUMRANGE) e = create_engine(postgresql://brian@10.0.1.10:5432/app, echo=True) Base.metadata.create_all(e) sess = Session(e) # Insert via string type foo_one = Foo(id=1, intrange

[sqlalchemy] Modified mapping in composite association proxy causes conflict with persistent instance

2014-07-08 Thread Brian Findlay
Hi Mike, I'm using your variant on the 'unique object' recipe (see previous posting http://goo.gl/I1buRz) with some composite association proxies. Recently, the data I've been working with introduced a duplicate in the property I've been using with attribute_mapped_collection(), so I'm trying

Re: [sqlalchemy] Modified mapping in composite association proxy causes conflict with persistent instance

2014-07-08 Thread Brian Findlay
Hmmm, must be a problem elsewhere. Sorry for wasting your time, Mike, but thanks for the test case. Donation enroute. On Tuesday, July 8, 2014 12:02:52 PM UTC-4, Michael Bayer wrote: a test case is attached, show me the failure please, thanks. On 7/8/14, 10:59 AM, Brian Findlay wrote

Re: [sqlalchemy] defaultdict functionality for association proxies

2014-07-03 Thread Brian Findlay
Ok, Mike. Thanks. Ended up removing the trigger from the model and pushing that code to the controller, so that foo updates the bar attribute after form data with UserCourse objects is handled. On Wednesday, July 2, 2014 9:42:11 PM UTC-4, Michael Bayer wrote: On 7/2/14, 2:59 PM, Brian

[sqlalchemy] defaultdict functionality for association proxies

2014-07-02 Thread Brian Findlay
at least help with the KeyError. How would you recommend tackling these problems? Thanks, Brian -- 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] defaultdict functionality for association proxies

2014-07-02 Thread Brian Findlay
to take the focus off the function itself in order to troubleshoot the event sequencing. -Brian On Wednesday, July 2, 2014 1:43:59 PM UTC-4, Michael Bayer wrote: On 7/2/14, 11:15 AM, Brian Findlay wrote: I've since added an event listener to perform a calculation each time a UserCourse

[sqlalchemy] Binding base classes to different engines

2014-04-26 Thread Brian Findlay
My project requires querying an externally-managed database as well as a project-specific database. What I've been doing to date is copying the external database (which changes very infrequently) into the project-specific database so I only need one engine and one dbsession. I'm now trying to

[sqlalchemy] Re: Binding base classes to different engines

2014-04-26 Thread Brian Findlay
Not sure if __abstract__ is the way to go. Should I instead be creating mixins? http://docs.sqlalchemy.org/en/rel_0_9/orm/extensions/declarative.html#mixin-and-custom-base-classes On Saturday, April 26, 2014 5:07:23 PM UTC-4, Brian Findlay wrote: My project requires querying an externally

[sqlalchemy] Re: Binding base classes to different engines

2014-04-26 Thread Brian Findlay
Continuing to troubleshoot. This produces the same exception: DBSession.configure(binds={DB1: db1_engine, DB2: db1_engine}) Note that I'm binding both classes to the original engine. I thought it would be the same as the working config: DBSession.configure(bind=db1_engine) -- You received

Re: [sqlalchemy] Re: Binding base classes to different engines

2014-04-26 Thread Brian Findlay
Thanks, Mike. Will check this out. -- 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

Re: [sqlalchemy] Re: Binding base classes to different engines

2014-04-26 Thread Brian Findlay
I'm almost certainly exposing my level of ignorance here, but does this mean I could just replace DBSession.configure(binds={DB1:db1_engine, DB2:db2_engine}) with DBSession.configure(class_=MySession) ? I suppose I could even use DBSession = scoped_session(sessionmaker(class_=MySession,

[sqlalchemy] Problem with list comprehension and composite association proxies

2014-03-11 Thread Brian Findlay
. Is this error the result of both association proxies using the same attribute mapped collection ('interest_name')? Garbage collection during the get_distance method or list comprehension? I'd appreciate any suggestions -- thanks. -Brian -- You received this message because you are subscribed

Re: [sqlalchemy] Problem with list comprehension and composite association proxies

2014-03-11 Thread Brian Findlay
Thanks, Mike. I found some records in the occupations table without interest values in the occupations_interests table, explaining the KeyErrors. Facepalm. -Brian -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group

[sqlalchemy] Inverse the mapping in a composite association proxy

2014-01-08 Thread Brian Findlay
Hi, all. I've been trying to modify the example of a composite association proxy (http://www.sqlalchemy.org/docs/orm/extensions/associationproxy.html#composite-association-proxies) to fit my needs. In the documentation example, there is a User object, a Keyword object, and a UserKeyword

Re: [sqlalchemy] Inverse the mapping in a composite association proxy

2014-01-08 Thread Brian Findlay
Well, if it isn't the man himself. Mike, you're awesome -- thanks for the hand-holding. Thanks for reading into my use case and providing the second example. Also, thanks for the thorough documentation (on SQLAlchemy and Mako). This would be infinitely more difficult without it. On another

Re: [sqlalchemy] Inverse the mapping in a composite association proxy

2014-01-08 Thread Brian Findlay
Mike, It took a few hours to wrap my head around your work and adapt it to my actual use case, but it's working great now...except for a particular case when used with templates. Basically, I'm querying for relevant courses and then iterating over the results to construct a form for grade

[sqlalchemy] Query help

2012-09-19 Thread Brian
Here is the initial information. SQLAlchemy Version : 0.7.4 Database backend: SQL Server 2005 Library interface : pyodbc 3.0.4 On a side note I tried updating to the latest SQLAlchemy version and the problem I am running into is still present. The problem I am running into is I build up a

[sqlalchemy] How do I get date types to match between MSSQL and Postgres

2011-09-29 Thread Brian
I have a postgres database local and stores data about our active students. The remote database for our SIS (Student Information System) is using Microsoft SQL. I'm using psycopg2 and pymssql libraries respectively. The date object types I'm getting back from these databases are different,

[sqlalchemy] Synchronizing data, want to track what has changed. Advice please.

2011-09-27 Thread Brian
hello all, I'm grabbing data from a Student Information System (SIS) about students and then saving that data in a local database. I then query my local database to create/modify/disable accounts in Active Directory and Google Apps. What I've been doing so far is the following: Set all

Re: [sqlalchemy] Synchronizing data, want to track what has changed. Advice please.

2011-09-27 Thread Brian
I'm not sure how I could do that because I'd want to set active to 0 only on the students that are no longer going to school here. Maybe merge isn't the right thing to do, or maybe I need to rethink my algorithm. The bottom line is I need to know what records get added to the local database

Re: [sqlalchemy] Synchronizing data, want to track what has changed. Advice please.

2011-09-27 Thread Brian
Thanks for your responses. I've been doing quite a bit of probing and I think I have what I need now to get the job done. Sorry for the confusion, I wasn't being very clear. The problem with setting active to 0 after the fact stems from the fact that I'm only querying each database for the

[sqlalchemy] MySQL INSERT ... ON DUPLICATE KEY UPDATE

2010-08-13 Thread brian
http://github.com/bedwards/sqlalchemy_mysql_ext -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to

[sqlalchemy] Re: ORM performance questions

2009-08-10 Thread Brian Granger
0.5.5 again is extremely recommended since the Session also is able to drop references to objects fully as of the same 0.5.2 release, so memory usage will be improved. OK, I was wondering about the memory issues. Thanks very much for this information! Brian

[sqlalchemy] ORM performance questions

2009-08-06 Thread Brian Granger
=True and autoflush=True I am using sqlalchemy 0.4 series with the sqlite that comes with python 2.5 on Win32. Thanks! Brian --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group

[sqlalchemy] Re: Mapper bug involving select with labeled foreign key target and clause default?

2007-10-28 Thread Brian Beck
Thanks for the response Mike... comments below. On Oct 28, 12:52 am, Michael Bayer [EMAIL PROTECTED] wrote: On Oct 27, 2007, at 8:33 PM, Brian Beck wrote: without trying it yet the first thing that seems wrong is that your select has no join condition between a_table and b_table (nor are you

[sqlalchemy] Mapper bug involving select with labeled foreign key target and clause default?

2007-10-27 Thread Brian Beck
Sorry for the confusing subject. If I map against a select in which one of the tables has a foreign key whose default value is set to a clause involving another table's column (also in the select), and that column is labeled, the correct values are inserted, but an exception is raised when

[sqlalchemy] Re: SQLAlchemy 0.4 beta2 released

2007-08-14 Thread Brian Beck
, and not a noun (why not engine/engines?) Keep up the good work! -- Brian Beck / Adventurer of the First Order / www.brianbeck.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send

[sqlalchemy] TextMate bundle for SQLAlchemy

2007-06-30 Thread Brian Beck
://blog.case.edu/bmb12/2007/06/30/SQLAlchemy_Bundle.mov Download: http://www.pagodacms.org/files/SQLAlchemy_Bundle.tar.gz Blog entry: http://blog.case.edu/bmb12/2007/06/sqlalchemy_bundle_for_textmate Improvements and ideas welcome... happy hacking! -- Brian Beck / Adventurer of the First Order / http

[sqlalchemy] Using MAX in a relation() without an inner SELECT

2007-04-27 Thread Brian Beck
is appreciated. Brian Beck / Adventurer of the First order / www.brianbeck.com --~--~-~--~~~---~--~~ 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

[sqlalchemy] Re: Saving all transactions against a database (logging queries?)

2007-01-09 Thread Brian Jarrett
specified, things worked. Once I started adding more parameters, I had similar problems. Brian On 1/6/07, jose [EMAIL PROTECTED] wrote: Hello Barry, I'm trying to get logging work...I put in my model.py the following code and I expected to see my queries into /tmp/sa.log file, but... what's wrong

[sqlalchemy] Re: Saving all transactions against a database (logging queries?)

2007-01-05 Thread Brian Jarrett
Excellent. Thank you for the clarification. Brian On 1/5/07, Michael Bayer [EMAIL PROTECTED] wrote: i havent gotten around to adding docs for logging to the main docs...but its using Python's logging module now. turn off all the echo=True flags and go straight to logging: import logging

[sqlalchemy] Re: Saving all transactions against a database (logging queries?)

2007-01-05 Thread Brian Jarrett
custom_20004='17-JAN-85' WHERE students.student_id = 514 I'll still have to trim the beginning of each line, but it's usable. Thanks for the help. Brian On 1/5/07, Michael Bayer [EMAIL PROTECTED] wrote: every other line is a repr() of the bind parameter dictionary sent to the query, so you

<    1   2