Re: [sqlalchemy] Specifying a Row Check Constraint and Compound Primary Keys

2014-07-30 Thread Werner
Hi Rich, I don't like using 'name' columns as primary keys I would instead use an 'id' column and would set 'index=True' on the name column. On the primary key also define a Sequence: Column('id', Integer, Sequence('tablename_id_seq'), primary_key=True)

Re: [sqlalchemy] Problem going from 0.7.10 to 0.8.7

2014-07-30 Thread Simon King
On Wed, Jul 30, 2014 at 3:30 AM, Mike Bernson m...@mlb.org wrote: I have started moving my code base from 0.7.10 to 0.8.7 as first step to getting to current version. (There code changes for me to get to 0.9.x where there are no code changes to run under 0.8.x) I have found a problem with a

Re: [sqlalchemy] How can I use the transaction to make sure data is one by on?

2014-07-30 Thread 'Frank Liou' via sqlalchemy
HI! Jonathan I use self.trans = self.connection.begin() but now i use debug lock before commit then i try to use my pgAdmin to add or update same data. and then it's sussesful to add data by pgAdmin i think that meaning my trans did not work and it maybe just can lock the same

Re: [sqlalchemy] Specifying a Row Check Constraint and Compound Primary Keys

2014-07-30 Thread Rich Shepard
On Wed, 30 Jul 2014, Werner wrote: I don't like using 'name' columns as primary keys I would instead use an 'id' column and would set 'index=True' on the name column. Werner, The use of natural keys (such as a vehicle VIN, the US's SSN, or equipment serial number) is prefered over an

Re: [sqlalchemy] Specifying a Row Check Constraint and Compound Primary Keys

2014-07-30 Thread Werner
Hi Rich, On 7/30/2014 15:04, Rich Shepard wrote: On Wed, 30 Jul 2014, Werner wrote: I don't like using 'name' columns as primary keys I would instead use an 'id' column and would set 'index=True' on the name column. Werner, The use of natural keys (such as a vehicle VIN, the US's SSN, or

[sqlalchemy] Issue with the QueuePool limit

2014-07-30 Thread qlands . software
I have seen many posts about the QueuePool limit but I really don't know how to solve it in my code. The error is: *TimeoutError: QueuePool limit of size 5 overflow 10 reached, connection timed out, timeout 30* I start one unique session in the __init__.py like this: engine =

Re: [sqlalchemy] Specifying a Row Check Constraint and Compound Primary Keys

2014-07-30 Thread Michael Bayer
On Jul 30, 2014, at 9:04 AM, Rich Shepard rshep...@appl-ecosys.com wrote: On Wed, 30 Jul 2014, Werner wrote: I don't like using 'name' columns as primary keys I would instead use an 'id' column and would set 'index=True' on the name column. Werner, The use of natural keys (such as a

Re: [sqlalchemy] Specifying a Row Check Constraint and Compound Primary Keys

2014-07-30 Thread Rich Shepard
On Wed, 30 Jul 2014, Michael Bayer wrote: Celko's books are great but surrogate integer PKs are an unavoidable practice within relational databases, they are a requirement of most DBAs I've dealt with as they perform predictably in terms of indexing and space requirements, especially

Re: [sqlalchemy] Specifying a Row Check Constraint and Compound Primary Keys

2014-07-30 Thread Michael Bayer
On Jul 30, 2014, at 12:28 PM, Rich Shepard rshep...@appl-ecosys.com wrote: On Wed, 30 Jul 2014, Michael Bayer wrote: Celko's books are great but surrogate integer PKs are an unavoidable practice within relational databases, they are a requirement of most DBAs I've dealt with as they

Re: [sqlalchemy] Specifying a Row Check Constraint and Compound Primary Keys

2014-07-30 Thread Rich Shepard
On Wed, 30 Jul 2014, Michael Bayer wrote: With that, plus the predictable indexing, I'm always going to use them. But, I think there's a fair degree of preference still here. With natural PKs, the biggest issue is how much space indexes are going to take up considering that everything that FKs

Re: [sqlalchemy] Specifying a Row Check Constraint and Compound Primary Keys

2014-07-30 Thread Rich Shepard
On Wed, 30 Jul 2014, Michael Bayer wrote: Typically a UNIQUE constraint is placed on the natural key to prevent dupes. I can see this when the natural key is a single column, but wonder how a compound natural key is represented if a serial integer is used as the surrogate 'id' key. For

Re: [sqlalchemy] Specifying a Row Check Constraint and Compound Primary Keys

2014-07-30 Thread Michael Bayer
You make a single explicit UniqueConstraint object that specifies all three. Sent from my iPhone On Jul 30, 2014, at 2:30 PM, Rich Shepard rshep...@appl-ecosys.com wrote: On Wed, 30 Jul 2014, Michael Bayer wrote: Typically a UNIQUE constraint is placed on the natural key to prevent

Re: [sqlalchemy] Specifying a Row Check Constraint and Compound Primary Keys

2014-07-30 Thread Rich Shepard
On Wed, 30 Jul 2014, Michael Bayer wrote: You make a single explicit UniqueConstraint object that specifies all three. Thanks, Mike. I missed that in the docs. Next question will appear only after a thorough search of your book. Rich -- You received this message because you are

Re: [sqlalchemy] referencing a `label` in a group by clause ?

2014-07-30 Thread Jonathan Vanasco
Revisiting this question, with coalesce. The target sql is: SELECT letter ,COALESCE(cache_counted, 0) AS counted FROM letters ORDER BY counted DESC The closest I can get to it is this: dbSession.query( sqlalchemy.func.count(

Re: [sqlalchemy] referencing a `label` in a group by clause ?

2014-07-30 Thread Michael Bayer
order_by('counted') ? there's a feature for 1.0 that will actually search out counted when you pass as a string and match it up too. On Jul 30, 2014, at 3:35 PM, Jonathan Vanasco jonat...@findmeon.com wrote: Revisiting this question, with coalesce. The target sql is: SELECT

[sqlalchemy] Single and Double Quotes

2014-07-30 Thread Rich Shepard
Is there a SQLAlchemy rule defining when single and double quotes are to be used? I see examples of both in a class, such as this example on page 103 of the 0.9.7 doc: class Entry(Base): __tablename__ = 'entry' entry_id = Column(Integer, primary_key=True) widget_id =

Re: [sqlalchemy] Single and Double Quotes

2014-07-30 Thread Michael Bayer
within python, single and double quotes are interchangeable and to the extent you see them used inconsistently is due to inconsistency on the part of myself and in some cases other developers who have written these docs. On Jul 30, 2014, at 4:44 PM, Rich Shepard rshep...@appl-ecosys.com wrote:

Re: [sqlalchemy] Single and Double Quotes

2014-07-30 Thread Rich Shepard
On Wed, 30 Jul 2014, Michael Bayer wrote: within python, single and double quotes are interchangeable and to the extent you see them used inconsistently is due to inconsistency on the part of myself and in some cases other developers who have written these docs. Mike, I thought that might

Re: [sqlalchemy] How can I use the transaction to make sure data is one by on?

2014-07-30 Thread Jonathan Rogers
On 07/30/2014 05:59 AM, 'Frank Liou' via sqlalchemy wrote: HI! Jonathan I use self.trans = self.connection.begin() but now i use debug lock before commit I'm afraid I don't know what that means. then i try to use my pgAdmin to add or update same data. At least that

Re: [sqlalchemy] mssql queries with accented column names fails

2014-07-30 Thread Viktor Nagy
FYI, I've found the corresponding pymssql bug. I hope for the fix being included in their next minor release. https://github.com/pymssql/pymssql/issues/185 2014. július 27., vasárnap 16:25:23 UTC+2 időpontban Michael Bayer a következőt írta: On Jul 27, 2014, at 8:58 AM, Viktor Nagy

Re: [sqlalchemy] mssql queries with accented column names fails

2014-07-30 Thread Michael Bayer
that’s great news! On Jul 30, 2014, at 6:11 PM, Viktor Nagy viktor.n...@gmail.com wrote: FYI, I've found the corresponding pymssql bug. I hope for the fix being included in their next minor release. https://github.com/pymssql/pymssql/issues/185 2014. július 27., vasárnap 16:25:23 UTC+2

Re: [sqlalchemy] referencing a `label` in a group by clause ?

2014-07-30 Thread Jonathan Vanasco
On Wednesday, July 30, 2014 3:49:15 PM UTC-4, Michael Bayer wrote: order_by(‘counted’) That generates: ORDER BY counted I can't figure out a way to apply `.desc()` (or specify `.asc()`) with that : ORDER BY counted DESC I tried going though the docs and constructing various

[sqlalchemy] vacation...

2014-07-30 Thread Michael Bayer
hey folks - I'm on vacation from thursday tomorrow through next thursday, so folks please hold down the fort! I won't be off the grid but I might not be able to get to my email as regularly. - mike -- You received this message because you are subscribed to the Google Groups sqlalchemy

Re: [sqlalchemy] vacation...

2014-07-30 Thread Rich Shepard
On Wed, 30 Jul 2014, Michael Bayer wrote: I'm on vacation from thursday tomorrow through next thursday, so folks please hold down the fort! I won't be off the grid but I might not be able to get to my email as regularly. mike, Have fun, travel safely, and don't worry about all of us. Rich

Re: [sqlalchemy] referencing a `label` in a group by clause ?

2014-07-30 Thread Simon King
On 30 Jul 2014, at 23:32, Jonathan Vanasco jonat...@findmeon.com wrote: On Wednesday, July 30, 2014 3:49:15 PM UTC-4, Michael Bayer wrote: order_by('counted') That generates: ORDER BY counted I can't figure out a way to apply `.desc()` (or specify `.asc()`) with that :

[sqlalchemy] Re: vacation...

2014-07-30 Thread Jonathan Vanasco
Go off the grid! You deserve it! -- 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] referencing a `label` in a group by clause ?

2014-07-30 Thread Jonathan Vanasco
THAT IS EXACTLY WHAT I NEEDED !!! I seriously spent a very stressful hour today combing through the docs and trying to construct something that would let me apply a `.desc()` ; I never thought of looking for a desc function to apply. Thank you so much! -- You received this message