[sqlalchemy] Dynamic Primary Keys

2020-03-03 Thread Nick Leaton
A how to question. I'd like to be able to create a table which has dynamic primary keys. Something along these lines. Lets say the main table is called Master. it has a generated id. Then a table that is an id and a name, called AliasType. It's then a many to many association between Maste

Re: [sqlalchemy] contains_eager, outerjoin, subquery, alias, and loading nested relationships of the same type

2018-08-08 Thread Nick Repole
Hm, I'll spend some time playing around with enable_relationship_loading and see if I can produce what I'm looking for. Thanks again for the help! On Tuesday, August 7, 2018 at 12:47:52 PM UTC-5, Mike Bayer wrote: > > On Mon, Aug 6, 2018 at 8:01 PM, Nick Repole > wrote:

Re: [sqlalchemy] contains_eager, outerjoin, subquery, alias, and loading nested relationships of the same type

2018-08-06 Thread Nick Repole
ith any changes being tracked/persisted,so such a scenario would accomplish what I'd need. But I realize my use case is pretty niche. On Monday, August 6, 2018 at 9:58:33 AM UTC-5, Mike Bayer wrote: > > On Sat, Aug 4, 2018 at 11:27 PM, Nick Repole > wrote: > > Hi, > > >

[sqlalchemy] contains_eager, outerjoin, subquery, alias, and loading nested relationships of the same type

2018-08-04 Thread Nick Repole
Hi, I'm attempting to load some filtered relationships, and am running into issues when trying to independently load the same relationship multiple times. As an example, I'd like to load Album.tracks, and Album.tracks.album.tracks in different ways. In the first tracks relationship, I'm trying

Re: [sqlalchemy] Joined/Eager loading into a non-relationship

2016-06-30 Thread Nick Whyte
ng a dict for student lookup, and then joining it to each student in the for loop. I hope this gives a better understanding into the problem I'm trying to solve. Thanks for your help so far! On Wednesday, June 15, 2016 at 11:35:01 PM UTC+10, Mike Bayer wrote: > > > &

[sqlalchemy] Joined/Eager loading into a non-relationship

2016-06-14 Thread Nick Whyte
Hey, I'm working on a more complex problem with the ORM functionality of SQLA. I have a reasonably simple relationship, ie, class A(Base): id = sa.Column(sa.Integer(), primary_key=True) b_collection = sa.orm.relationship('B') class B(Base): id = sa.Column(sa.Integer(), primary_k

Re: [sqlalchemy] Re: Composite Pattern

2011-03-31 Thread Nick Leaton
_wednesday, calendars.thurday AS calendars_thurday, calendars.friday AS calendars_friday, calendars.saturday AS calendars_saturday, calendars.sunday AS calendars_sunday FROM calendars, calendar_children WHERE calendar_children.parent_id = ? AND calendar_children.child_id = calendars.id* 2011-0

Re: [sqlalchemy] Idempotent updating (Update or insert)

2010-11-25 Thread Nick Leaton
Thanks Michael, I'll check the two articles out tonight Nick On 25 November 2010 17:05, Michael Bayer wrote: > > On Nov 25, 2010, at 11:02 AM, Nickle wrote: > >> I'm trying to get my head around idempotent updating. >> >> ie I'm creating some ob

[sqlalchemy] Re: Am I really doing this right?

2010-06-03 Thread Nick Retallack
Pretend I bound that metadata and session to an engine at some point... On Jun 3, 12:59 pm, Nick Retallack wrote: > On Jun 3, 8:53 am, Michael Bayer wrote: > > > > Is it a common practice to pass the current session into the > > > constructor of an ORM model?   > >

[sqlalchemy] Re: Am I really doing this right?

2010-06-03 Thread Nick Retallack
On Jun 3, 8:53 am, Michael Bayer wrote: > > Is it a common practice to pass the current session into the > > constructor of an ORM model?   > > no.   The session consumes your objects, not the other way around.  An object > can always get its current session via object_session(self). > > > At thi

[sqlalchemy] Am I really doing this right?

2010-06-02 Thread Nick Retallack
I have a lot of questions, so bear with me. I've been having some doubts about whether I'm really using sqlalchemy in a good way. -- Is there any use case for having more than one session active in the same thread? Or does everyone use threadlocal sessions? If you bind different tables to diff

[sqlalchemy] Re: Output/Update Current Schema?

2009-12-25 Thread Nick Retallack
Thanks for all the info. I feel a lot better about using this orm now =] On Dec 24, 7:50 pm, Michael Bayer wrote: > On Dec 24, 2009, at 3:44 PM, Nick Retallack wrote: > > > I've looked at sqlalchemy-migrate, but I can't figure out how it > > works.  Can you give me a

[sqlalchemy] Re: Output/Update Current Schema?

2009-12-24 Thread Nick Retallack
Dec 22, 2:06 pm, Michael Bayer wrote: > On Dec 21, 2009, at 9:05 PM, Nick Retallack wrote: > > > Say you've created some models in SQLAlchemy, and run create_all() to > > get them into the database.  Later on, you changed some of their > > definitions, and you need to upd

[sqlalchemy] Output/Update Current Schema?

2009-12-21 Thread Nick Retallack
Say you've created some models in SQLAlchemy, and run create_all() to get them into the database. Later on, you changed some of their definitions, and you need to update the database schema to correspond to it. How would you do this? Can you get SQLAlchemy to output the current SQL representatio

[sqlalchemy] Re: Empty inserts and objects with no attributes

2009-10-06 Thread Nick Murphy
Hi Mike, I'm using SQLite, and I'm tracking svn trunk (I'm at revision 6390). Is the newer sqlite backend you mentioned somewhere else? Thanks, Nick On Oct 6, 8:49 am, "Michael Bayer" wrote: > Nick Murphy wrote: > > > Hi, > > > A class of mine ha

[sqlalchemy] Empty inserts and objects with no attributes

2009-10-06 Thread Nick Murphy
Is there a common workaround for this? Thanks, Nick --~--~-~--~~~---~--~~ 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 th

[sqlalchemy] How do I execute Oracle custom functions?

2009-08-14 Thread Nick Martin
[func.blah.fishcakes(foo)]) Which produces, "select blah.fishcakes(foo) from dual;" allowing one to select from a stored procedure. I am wondering if there is a way to execute custom functions programmatically in sqlalchemy. Thanks Nick --~--~-~--~~~---~--~-

[sqlalchemy] Simple distinct aggregates in query?

2009-07-31 Thread Nick Bower
rn list of district years (possibly with number of rows in each if possible) 2) For year X, return distinct list of days that there are rows for. All this seems to hinge on having access to a sql function that operators on the timestamp server-side. Th

[sqlalchemy] Re: Setting up a many-to-many relation with no right-hand-side table

2008-09-30 Thread Nick Murdoch
On Sep 30, 3:06 pm, Michael Bayer <[EMAIL PROTECTED]> wrote: > On Sep 30, 2008, at 4:59 AM, Nick Murdoch wrote: > > > > > > > > >> we have the "wrapper" thing, its the associationproxy.   docs are > >> here:   > >> http

[sqlalchemy] Re: Setting up a many-to-many relation with no right-hand-side table

2008-09-30 Thread Nick Murdoch
lem.state is not None], trans, delete=False) File "/usr/lib/python2.4/site-packages/SQLAlchemy-0.4.6-py2.4.egg/ sqlalchemy/orm/dependency.py", line 193, in process_dependencies self._synchronize(state, child, None, True, uowcommit) File "/usr/lib/python2.4/site-pac

[sqlalchemy] Setting up a many-to-many relation with no right-hand-side table

2008-09-29 Thread Nick Murdoch
NSERT INTO user_articles (user_id, session_id) VALUES >>> (1, 1000); Is this possible using SQLAlchemy? I'm aware I could simply perform inserts and selects manually on the user_articles_table, but I'd quite like SA to take care of that for me if at all possible. I&#

[sqlalchemy] Re: Default collection class for unordered relations

2008-05-15 Thread Nick Murphy
> Logic that depends on any ordering from a non-ORDER BY result is a bug, > but I don't know that the impact of presenting all users with a new, > non-standard, non-native collection type and injecting some kind of > __eq__ into mapped classes to satisfy a multiset contract is worth it > for what

[sqlalchemy] Re: Default collection class for unordered relations

2008-05-15 Thread Nick Murphy
> if we had a totally explicit "collection class is required" approach, > that would be something different (like, cant use "list" as a > collection unless order_by is present). We might just say in any case > that "order_by" is required with "list"but then that might be too > steep a change

[sqlalchemy] Re: Default collection class for unordered relations

2008-05-15 Thread Nick Murphy
> mmh. between db's - maybe u're right. But the order will also change > depending on current hash-values between 2 runs on otherwise same > system... There's plenty of difficulties to get a repeatable flow for > tests etc already. That's exactly my point in fact -- unless order_by is specified,

[sqlalchemy] Default collection class for unordered relations

2008-05-15 Thread Nick Murphy
, one cannot rely on a collection having a particular order. I could see this as helpful in preventing bugs when switching between databases (e.g. from MySQL to PostgreSQL) with different default ordering behaviors. Regards, Nick --~--~-~--~~~---~--~~ You received this

[sqlalchemy] Joining a table to itself.

2008-02-12 Thread Nick Murdoch
=True), ) I'm completely stuck on the mappers, though. I've got the User <-> Interest one set up okay (I think) but SQLAlchemy refuses to generate the SQL for User <-> User. Thanks for any help, Nick --~--~-~--~~~---~--~~ You received this

[sqlalchemy] SQLite schema select bug?

2008-01-25 Thread Nick Joyce
. Am I missing something? Cheers, Nick --~--~-~--~~~---~--~~ 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, sen

[sqlalchemy] Re: Atomic update to balance in transaction with ORM changes

2007-08-01 Thread Nick Johnson
there a way I can do this without locking, though, such as by adding my own UPDATE query to the transaction? -Nick Johnson --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to

[sqlalchemy] Atomic update to balance in transaction with ORM changes

2007-08-01 Thread Nick Johnson
o create the user_products record. Ideally, I need to update the relevant User object with the updated balance, too. Can anyone provide me with a quick overview of how to do this? Thanks, Nick Johnson --~--~-~--~~~---~--~~ You received this message because you are

[sqlalchemy] Re: sqlite func,datetime

2007-07-06 Thread Nick
27;2007-01-01' which seemed to work ok). I'm new to SA so perhaps i should have been doing that all along anyway. Cheers Nick On 5 Jul, 15:29, Michael Bayer <[EMAIL PROTECTED]> wrote: > On Jul 5, 2007, at 6:00 AM, Nick wrote: > > > class TestC(Entity): > > with

[sqlalchemy] sqlite func,datetime

2007-07-05 Thread Nick
take the following code with sqlite 3.4 on cygwin, and i get strftime error on insert, any ideas? Python 2.5.1 (r251:54863, May 18 2007, 16:56:43) [GCC 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)] on cygwin Type "help", "copyright", "credits" or "license" for more information. from elixir