Re: [sqlalchemy] Syntax error from sqlalchemy generated sql to sybase ase

2018-11-28 Thread Ken MacKenzie
catches I have to do to write to other DB's, I can maybe just write raw SQL through sql alchemy or worst case through pyodbc to deal with collecting the records. Thank you for the help. Ken On Wednesday, November 28, 2018 at 6:12:41 PM UTC-5, Mike Bayer wrote: > > Hi there - > > U

[sqlalchemy] Syntax error from sqlalchemy generated sql to sybase ase

2018-11-28 Thread Ken MacKenzie
ads to that. If I take that statement as is and paste into dbeaver (replacing the \n with an actual carriage return) everything works. This fails on both linux (using FreeTDS version set to 5) and windows (using the dsn name for the actual ASE driver setup in my odbc) I am confused what is g

Re: [sqlalchemy] How to convert character set of the column with sqlalchemy?

2017-12-20 Thread Ken Liu
very good! It's fine. thank you, Mike Bayer ! On Wednesday, December 20, 2017 at 10:08:49 PM UTC+8, Mike Bayer wrote: > > On Wed, Dec 20, 2017 at 4:36 AM, Ken Liu <liuji...@gmail.com > > wrote: > > I want to convert query.order_by(cast(Channel.cname, String) to >

[sqlalchemy] How to convert character set of the column with sqlalchemy?

2017-12-20 Thread Ken Liu
I want to convert query.order_by(cast(Channel.cname, String) to cast(cname AS CHAR CHARACTER SET gbk),how do I do that? please help me. -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal,

Re: [sqlalchemy] Is Textual SQL DB neutral

2017-08-31 Thread Ken MacKenzie
for this process as what we are dealing with is a data replication service pulling from a u2 data store to sql server. The delete is part of batch cleanup testing. On Thursday, August 31, 2017 at 5:13:58 PM UTC-4, Ken MacKenzie wrote: > > Tried doing various conversions on the pk values as they

Re: [sqlalchemy] Is Textual SQL DB neutral

2017-08-31 Thread Ken MacKenzie
that this can be an issue with pyodbc and that there are engine settings related to it. Also perhaps I should try using the pymssql driver to see if that changes anything. On Thursday, August 31, 2017 at 5:00:47 PM UTC-4, Ken MacKenzie wrote: > > So inspecting the elements of the tuple, they are bo

Re: [sqlalchemy] Is Textual SQL DB neutral

2017-08-31 Thread Ken MacKenzie
So inspecting the elements of the tuple, they are both str, so hence unicode. Are you saying that if I convert those values to bytes it could improve performance? > I'd not bother with the literal_binds and just use a literal value: > > pkf = [(col == literal_column("'%s'" % v)) for (col,

Re: [sqlalchemy] Is Textual SQL DB neutral

2017-08-31 Thread Ken MacKenzie
So here is my solution as of now. As far as I can tell hits the marks of: 1. DB Neutral 2. Performance (9k records deleted in 5 seconds) 3. Generic (excuse the print statements still there for testing) Would welcome comments on this proposed solution. I have learned a lot from the advice in

Re: [sqlalchemy] Is Textual SQL DB neutral

2017-08-31 Thread Ken MacKenzie
params. So I know this is not recommended but to retain DB neutrality can I use the output from query.statement.compile(dialect=s.bind.dialect, compile_kwargs={"literal_binds": True}) and feed that output back in direct to execute? On Thursday, August 31, 2017 at 6:41:17 AM UTC-4, K

Re: [sqlalchemy] Is Textual SQL DB neutral

2017-08-31 Thread Ken M
in your original version meant 2000 bind > parameters. > > Try with a batch sizes of 10, 50 and 100. You'll run more queries but > I suspect each query will perform better. > > Simon > >> On Wed, Aug 30, 2017 at 10:02 PM, Ken MacKenzie <deviloc...@gmail.com> w

Re: [sqlalchemy] Is Textual SQL DB neutral

2017-08-31 Thread Ken M
s? > > If none of those are issues for you, the textual version is probably > pretty safe. > > Simon > >> On Wed, Aug 30, 2017 at 5:30 PM, Ken MacKenzie <deviloc...@gmail.com> wrote: >> Not sure how I would iterate through a non predetermined number of primary &

Re: [sqlalchemy] Is Textual SQL DB neutral

2017-08-30 Thread Ken M
When I get in tomorrow I will take a look at some of these options. I also intend to spin up a quick MySQL or postgresql db to test if my textual solution can work against an alternate target. Sent from my iPad > On Aug 30, 2017, at 6:20 PM, Jonathan Vanasco wrote: > >

Re: [sqlalchemy] Is Textual SQL DB neutral

2017-08-30 Thread Ken MacKenzie
different. On Wednesday, August 30, 2017 at 4:41:38 PM UTC-4, Ken MacKenzie wrote: > > I am noticing the 16 execute calls. There should only be 10 with a batch > size of 1000 and a record size of 9,000 and some change. > > Are you just wanting to see the sql via a print(q)? &

Re: [sqlalchemy] Is Textual SQL DB neutral

2017-08-30 Thread Ken MacKenzie
With a batch size of 1 based on the original selection, no improvement. I am going to see what sql this is creating. 2328928 function calls (2085124 primitive calls) in 1084.925 seconds Ordered by: internal time ncalls tottime percall cumtime percall

Re: [sqlalchemy] Is Textual SQL DB neutral

2017-08-30 Thread Ken MacKenzie
16 SQL statements that take a very different > amount of time depending on format. Can you please paste the output > with echo=True on create_engine() so that the difference in SQL > statements can be seen? > > On Wed, Aug 30, 2017 at 12:30 PM, Ken MacKenzie <devil...@gmail.com > &

Re: [sqlalchemy] Is Textual SQL DB neutral

2017-08-30 Thread Ken MacKenzie
I tried an alternate version: @classmethod def dict_delete2(cls, dict_in): """ Delete records from the database based on a dictionary keyed by PK tuple """ s = dbc.get_session() keys_in = ["-".join(k) for k in dict_in.keys()]

Re: [sqlalchemy] Is Textual SQL DB neutral

2017-08-30 Thread Ken MacKenzie
table.c.pk1 == sa.bindparam('pk1'), > table.c.pk2 == sa.bindparam('pk2'), > ) > statement = sa.delete(table, whereclause=condition) > batchparams = [{'pk1': v[0], 'pk2': v[1]} for v in id_batch] > session.execute(statement, batchparams) > > Simon > > On

Re: [sqlalchemy] Is Textual SQL DB neutral

2017-08-30 Thread Ken MacKenzie
Sorted Textual SQL profile ncalls tottime percall cumtime percall filename:lineno(function) 161.8400.1151.8400.115 {method 'execute' of 'pyodbc.Cursor' objects} 95720.1960.0000.7880.000 elements.py:1860(_construct) 577000.1890.000

Re: [sqlalchemy] Is Textual SQL DB neutral

2017-08-30 Thread Ken MacKenzie
Sorted: ncalls tottime percall cumtime percall filename:lineno(function) 16 1053.794 65.862 1053.794 65.862 {method 'execute' of 'pyodbc.Cursor' objects} 348916/3483110.5390.0000.5560.000 {built-in method isinstance} 160920/1609180.3130.0000.313

Re: [sqlalchemy] Is Textual SQL DB neutral

2017-08-30 Thread Ken MacKenzie
After the current sorted profile finishes I will revert to the textual version and run a profile on that. I expect another 10-15 minutes for this to finish right now. At present the batch size is set to 1000, total record count is just over 9000 in these tests. The reason for 1000 was at

Re: [sqlalchemy] Is Textual SQL DB neutral

2017-08-30 Thread Ken MacKenzie
t; You could try playing with your batch sizes to see what sort of effect > that has. > > Simon > > On Wed, Aug 30, 2017 at 4:01 PM, Ken MacKenzie <devil...@gmail.com > > wrote: > > So I implemented this version with one change. I moved this line: > >

Re: [sqlalchemy] Is Textual SQL DB neutral

2017-08-30 Thread Ken MacKenzie
, August 30, 2017 at 4:43:01 AM UTC-4, Simon King wrote: > > On Tue, Aug 29, 2017 at 9:49 PM, Ken MacKenzie <devil...@gmail.com > > wrote: > > I have a query I have constructed and I had to deal with a composite > primary > > key to select items; > &

[sqlalchemy] Is Textual SQL DB neutral

2017-08-29 Thread Ken MacKenzie
eading me to believe that SQL Server (or at least the version we are using) does not support tuples. Ken -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable

Re: [sqlalchemy] A story of a field named object... and is it a big deal

2017-08-11 Thread Ken MacKenzie
Thank you everyone for the responses. I think it is not as big a deal as I might have been expecting,. The purist in me does not like redefining object. But from an api perspective there is not cleaner and purpose built name for the field in question. Ken -- SQLAlchemy - The Python SQL

Re: [sqlalchemy] A story of a field named object... and is it a big deal

2017-08-09 Thread Ken MacKenzie
yeah but I have it in the model as class gltable(Base): ... object = column(string(6)) On Wed, Aug 9, 2017 at 6:33 PM, Mike Bayer <mike...@zzzcomputing.com> wrote: > On Wed, Aug 9, 2017 at 2:12 PM, Ken MacKenzie <deviloc...@gmail.com> > wrote: > > So I have been usin

[sqlalchemy] A story of a field named object... and is it a big deal

2017-08-09 Thread Ken MacKenzie
into an in use prototype (ain't that always the way). I just wanted to get some more experienced feedback in case any of the data consumers start asking why I am wanting to change something that works to rename this field. Ken -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http

[sqlalchemy] Question about eagerloading and depth of inheritance with respect to polymorphic mappings

2016-06-14 Thread Ken Linehan
be greatly appreciated. Sorry if I'm missing something that is already clearly stated in the documentation. Best, Ken -- 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, sen

Re: [sqlalchemy] SQLAlchemy: Database Access Using Python - Developer's Library book

2015-11-08 Thread Ken Lareau
On Thu, Nov 5, 2015 at 7:34 AM, Mike Bayer <mike...@zzzcomputing.com> wrote: > > > On 11/03/2015 06:55 PM, Ken Lareau wrote: > >> I came across this during a search, and in the four different sites >> I've checked, I've seen four different release dates varying fro

[sqlalchemy] SQLAlchemy: Database Access Using Python - Developer's Library book

2015-11-03 Thread Ken Lareau
hoping I might be able to find out more here. :) -- Ken Lareau -- 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.co

Re: [sqlalchemy] Sane way to monitor external DB changes from application?

2015-09-02 Thread Ken Lareau
Dave, Thanks for the response. Unfortunately the switch to PostgreSQL, while not a long ways away, probably will not occur until at least the beginning of next year and this rewrite is needed now. If there are no other options available then I'll just need to brute force it. :) - Ken On Wed

[sqlalchemy] Sane way to monitor external DB changes from application?

2015-09-02 Thread Ken Lareau
rs on the DB side, but I'm unsure if that's a valid possibility here? Hopefully this made sense, but if any clarification is needed, please let me know. -- Ken Lareau klar...@ifwe.co -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To u

[sqlalchemy] Multiple delete attempts of same rows with a star schema configuration

2014-09-04 Thread Ken Lareau
once, but each relationship in project is triggering its own delete which is bad. So... help? Am I missing something simple here, or is my model not good enough to do the right thing? -- - Ken Lareau -- You received this message because you are subscribed to the Google Groups sqlalchemy group

Re: [sqlalchemy] Multiple delete attempts of same rows with a star schema configuration

2014-09-04 Thread Ken Lareau
On Thu, Sep 4, 2014 at 3:30 PM, Michael Bayer mike...@zzzcomputing.com wrote: On Sep 4, 2014, at 5:37 PM, Ken Lareau klar...@tagged.com wrote: So I have a few tables as follows (abbreviated for unnecessary columns): class Project(Base): __tablename__ = 'projects' id = Column

Re: [sqlalchemy] Multiple delete attempts of same rows with a star schema configuration

2014-09-04 Thread Ken Lareau
On Thu, Sep 4, 2014 at 4:35 PM, Michael Bayer mike...@zzzcomputing.com wrote: On Sep 4, 2014, at 6:58 PM, Ken Lareau klar...@tagged.com wrote: On Thu, Sep 4, 2014 at 3:30 PM, Michael Bayer mike...@zzzcomputing.com wrote: On Sep 4, 2014, at 5:37 PM, Ken Lareau klar...@tagged.com wrote

Re: [sqlalchemy] Multiple delete attempts of same rows with a star schema configuration

2014-09-04 Thread Ken Lareau
On Thu, Sep 4, 2014 at 4:54 PM, Michael Bayer mike...@zzzcomputing.com wrote: On Sep 4, 2014, at 7:50 PM, Ken Lareau klar...@tagged.com wrote: Is there a way to essentially allow something like 'for app in project.applications:' without having to make an explicit query to the DB first

[sqlalchemy] Re: Multiple tables and foreignkey constraints

2014-07-25 Thread Ken Roberts
This is probably violating some normal form, but after playing with it (Thanks Michael and Jonathan), this seems to work for what I'm using. Suggestions welcome on improving it. #!/usr/bin/env python from sqlalchemy import Column, ForeignKey, Integer, MetaData, Sequence, String, \

[sqlalchemy] Re: Multiple tables and foreignkey constraints

2014-07-25 Thread Ken Roberts
Thanks for the help Jonathan and Michael. The below seems to work for what I'm doing. Let me know what normal forms I'm violating with it :) from sqlalchemy import Column, ForeignKey, Integer, MetaData, Sequence, String, \ create_engine from sqlalchemy.orm import backref,

Re: [sqlalchemy] Multiple tables and foreignkey constraints

2014-07-22 Thread Ken Roberts
If I'm understanding correctly, something like the following: # Keep track of manufacturer names manufacturers_table = Table(u'manufacturer', metadata, Column(u'id', Integer, primary_key=True, Column(u'name', String(20)) ) # Keep track of model names models_table = Table(u'model',

Re: [sqlalchemy] Multiple tables and foreignkey constraints

2014-07-21 Thread Ken Roberts
On Monday, July 21, 2014 8:38:54 AM UTC-7, Jonathan Vanasco wrote: I agree with what Mike said, but I would just suggest renaming projector_table to something like purchased_table or inventory_table. Everything in models is a different model of a projector, so the table names are a bit

Re: [sqlalchemy] Multiple tables and foreignkey constraints

2014-07-21 Thread Ken Roberts
Forgot to mention that during typical operation, the only time the database will be accessed would be during down time (add/delete) or program startup (retrieve list of projectors to control) - not during a presentation. -- You received this message because you are subscribed to the Google

[sqlalchemy] (Semi-)automated way to adjust constraint names via Alembic?

2014-07-02 Thread Ken Lareau
and determine each by hand, but I was wondering if there was a less manual (and error-prone) way to approach this, possibly via the autogeneration feature? In case it matters, the database server is MySQL. -- - Ken Lareau -- You received this message because you are subscribed to the Google

Re: [sqlalchemy] (Semi-)automated way to adjust constraint names via Alembic?

2014-07-02 Thread Ken Lareau
'PRIMARY' for the name of the constraint and I'm not even sure that's changeable (been putting together a test data- base to try it out on)). But I'll see what I can hack together. :) - Ken On 7/2/14, 6:08 PM, Ken Lareau wrote: So, in my ongoing quest to make my team's operations

[sqlalchemy] Regarding the use of reciprocal relationships

2014-07-01 Thread Ken Lareau
reciprocal relationships is okay, and are there certain things that should be done to mitigate potential issues that can be caused by doing so, or are there better ways to accomplish the same thing? -- - Ken Lareau -- You received this message because you are subscribed to the Google Groups

Re: [sqlalchemy] Regarding the use of reciprocal relationships

2014-07-01 Thread Ken Lareau
On Tue, Jul 1, 2014 at 2:17 PM, Mike Bayer mike...@zzzcomputing.com wrote: On 7/1/14, 4:54 PM, Ken Lareau wrote: Related to one of my recent posted threads here, I'm recalling a certain conversation at PyCon where I was mentioning how a friend would define a many-to-many relationship

Re: [sqlalchemy] A question regarding hybrid properties, relationships and schema changes

2014-07-01 Thread Ken Lareau
On Thu, Jun 26, 2014 at 7:47 PM, Ken Lareau klar...@tagged.com wrote: On Jun 26, 2014 7:40 PM, Mike Bayer mike...@zzzcomputing.com wrote: right, so a few emails ago I said: you need to put .label('environment') on that column before it finds its way into subq. I dont have

Re: [sqlalchemy] A question regarding hybrid properties, relationships and schema changes

2014-07-01 Thread Ken Lareau
**SIGH** Please ignore last message... I had forgotten to actually update the database schema itself. :( Pardon me while I go shoot myself... - Ken On Tue, Jul 1, 2014 at 4:19 PM, Ken Lareau klar...@tagged.com wrote: On Thu, Jun 26, 2014 at 7:47 PM, Ken Lareau klar...@tagged.com wrote

Re: [sqlalchemy] A question regarding hybrid properties, relationships and schema changes

2014-06-26 Thread Ken Lareau
On Thu, Jun 26, 2014 at 5:57 AM, Mike Bayer mike...@zzzcomputing.com wrote: On 6/25/14, 8:06 PM, Ken Lareau wrote: On Wed, Jun 25, 2014 at 6:28 AM, Mike Bayer mike...@zzzcomputing.com wrote: On 6/25/14, 2:26 AM, Ken Lareau wrote: On Tue, Jun 24, 2014 at 3:35 PM, Mike Bayer mike

Re: [sqlalchemy] A question regarding hybrid properties, relationships and schema changes

2014-06-26 Thread Ken Lareau
that might come from the code itself; hopefully I didn't miss any, but if there's still confusion, let me know. - Ken On 6/26/14, 4:11 PM, Ken Lareau wrote: On Thu, Jun 26, 2014 at 5:57 AM, Mike Bayer mike...@zzzcomputing.com wrote: On 6/25/14, 8:06 PM, Ken Lareau wrote: On Wed, Jun 25

Re: [sqlalchemy] A question regarding hybrid properties, relationships and schema changes

2014-06-26 Thread Ken Lareau
Done, new file attached (this gives the same error message as the one I showed initially, at least on my system). - Ken -- 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

Re: [sqlalchemy] A question regarding hybrid properties, relationships and schema changes

2014-06-26 Thread Ken Lareau
, considered it insane. :) - Ken On 6/26/14, 9:50 PM, Ken Lareau wrote: Done, new file attached (this gives the same error message as the one I showed initially, at least on my system). - Ken -- You received this message because you are subscribed to the Google Groups sqlalchemy group

Re: [sqlalchemy] A question regarding hybrid properties, relationships and schema changes

2014-06-25 Thread Ken Lareau
On Tue, Jun 24, 2014 at 3:35 PM, Mike Bayer mike...@zzzcomputing.com wrote: On 6/23/14, 8:09 PM, Ken Lareau wrote: if apptier: subq = ( Session.query( Package.pkg_name, Package.version, Package.revision

Re: [sqlalchemy] A question regarding hybrid properties, relationships and schema changes

2014-06-24 Thread Ken Lareau
Anyone? This has me dead in the water and nothing in the documentation has been helping. - Ken On Mon, Jun 23, 2014 at 5:09 PM, Ken Lareau klar...@tagged.com wrote: On Fri, Jun 20, 2014 at 3:46 PM, Ken Lareau klar...@tagged.com wrote: On Fri, Jun 20, 2014 at 1:23 PM, Mike Bayer mike

Re: [sqlalchemy] A question regarding hybrid properties, relationships and schema changes

2014-06-23 Thread Ken Lareau
On Fri, Jun 20, 2014 at 3:46 PM, Ken Lareau klar...@tagged.com wrote: On Fri, Jun 20, 2014 at 1:23 PM, Mike Bayer mike...@zzzcomputing.com wrote: On 6/20/14, 3:38 PM, Ken Lareau wrote: So in the ongoing improvement of one of our internal databases, we created a new table named

[sqlalchemy] A question regarding hybrid properties, relationships and schema changes

2014-06-20 Thread Ken Lareau
occur, so I turn to those with more expertise to find out if there is a way to accomplish what I desire, or if there's really no hope. :) Any insight would be greatly appreciated. -- - Ken Lareau -- You received this message because you are subscribed to the Google Groups sqlalchemy group

Re: [sqlalchemy] A question regarding hybrid properties, relationships and schema changes

2014-06-20 Thread Ken Lareau
On Fri, Jun 20, 2014 at 1:23 PM, Mike Bayer mike...@zzzcomputing.com wrote: On 6/20/14, 3:38 PM, Ken Lareau wrote: So in the ongoing improvement of one of our internal databases, we created a new table named 'environments' whose SQLA code looks something like this: class Environment

[sqlalchemy] Trying to get a 'global' session to work for SQLAlchemy database library tests

2013-10-11 Thread Ken Lareau
enough to always understand why my current code works (and I have a full application using this without issue at the moment). So I guess the question is: am I missing something really obvious here, or will I need to rethink how I deal with sessions in my library code? Thanks in advance. -- - Ken

Re: [sqlalchemy] Trying to get a 'global' session to work for SQLAlchemy database library tests

2013-10-11 Thread Ken Lareau
On Fri, Oct 11, 2013 at 5:53 PM, Michael Bayer mike...@zzzcomputing.comwrote: On Oct 11, 2013, at 7:14 PM, Ken Lareau klar...@tagged.com wrote: In the process of trying to find an efficient way to manage a test database for a large set of tests for a database library I'm writing that uses

Re: [sqlalchemy] Re: Duplicating primary key value into another column upon insert?

2013-09-25 Thread Ken Lareau
this time, there will be future column renames that are far more insidious and may require it, so I would also like to know if the above will work as well. :) -- - Ken Lareau -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from

Re: [sqlalchemy] Duplicating primary key value into another column upon insert?

2013-09-24 Thread Ken Lareau
On Tue, Sep 24, 2013 at 7:25 AM, Michael Bayer mike...@zzzcomputing.comwrote: On Sep 23, 2013, at 10:04 PM, Ken Lareau klar...@tagged.com wrote: Hopefully this will make sense... I have a database which is in need of some normalization of the column naming in various tables

Re: [sqlalchemy] Duplicating primary key value into another column upon insert?

2013-09-24 Thread Ken Lareau
On Tue, Sep 24, 2013 at 10:32 AM, Michael Bayer mike...@zzzcomputing.comwrote: On Sep 24, 2013, at 12:00 PM, Ken Lareau klar...@tagged.com wrote: Of course, this leads back to the original question... how exactly does one accomplish this? :) Hopefully the clarification above helps

Re: [sqlalchemy] Duplicating primary key value into another column upon insert?

2013-09-24 Thread Ken Lareau
On Tue, Sep 24, 2013 at 11:10 AM, Ken Lareau klar...@tagged.com wrote: On Tue, Sep 24, 2013 at 10:32 AM, Michael Bayer mike...@zzzcomputing.comwrote: On Sep 24, 2013, at 12:00 PM, Ken Lareau klar...@tagged.com wrote: Of course, this leads back to the original question... how

Re: [sqlalchemy] Duplicating primary key value into another column upon insert?

2013-09-24 Thread Ken Lareau
On Tue, Sep 24, 2013 at 2:53 PM, Michael Bayer mike...@zzzcomputing.comwrote: On Sep 24, 2013, at 5:42 PM, Ken Lareau klar...@tagged.com wrote: On Tue, Sep 24, 2013 at 11:10 AM, Ken Lareau klar...@tagged.com wrote: On Tue, Sep 24, 2013 at 10:32 AM, Michael Bayer mike...@zzzcomputing.com

[sqlalchemy] Duplicating primary key value into another column upon insert?

2013-09-23 Thread Ken Lareau
the docs so far hasn't turned up anything useful, I'm afraid... Thanks in advance. -- - Ken Lareau -- 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

[sqlalchemy] SQLAlchemy introspection of relationships

2013-04-16 Thread ken
This has also been posted here: http://stackoverflow.com/questions/15950375/sqlalchemy-introspection-of-relationships, shoulda asked here first. I have a use case for modelling data in a SQL schema rather than through defining SQLAlchemy objects. However, i require a way to construct the

Re: [sqlalchemy] How to handle 'sub-commits'?

2013-01-17 Thread Ken Lareau
and sqlalchemy.exc.InvalidRequestError: Object 'HostDeployments at 0x21cd050' is already attached to session '1' (this is '3') Sadly it's not immediately obvious as to what's going on... not even certain how to start debugging this problem. - Ken On Tue, Jan 8, 2013 at 2:59 PM, Ken Lareau klar...@tagged.com wrote: On Tue

Re: [sqlalchemy] How to handle 'sub-commits'?

2013-01-17 Thread Ken Lareau
On Thu, Jan 17, 2013 at 4:13 PM, Michael Bayer mike...@zzzcomputing.comwrote: On Jan 17, 2013, at 7:01 PM, Ken Lareau wrote: On Thu, Jan 17, 2013 at 3:54 PM, Michael Bayer mike...@zzzcomputing.comwrote: On Jan 17, 2013, at 6:45 PM, Ken Lareau wrote: Sadly, it looks like when I try

Re: [sqlalchemy] How to handle 'sub-commits'?

2013-01-17 Thread Ken Lareau
On Thu, Jan 17, 2013 at 4:26 PM, Michael Bayer mike...@zzzcomputing.comwrote: On Jan 17, 2013, at 7:24 PM, Ken Lareau wrote: On Thu, Jan 17, 2013 at 4:13 PM, Michael Bayer mike...@zzzcomputing.comwrote: On Jan 17, 2013, at 7:01 PM, Ken Lareau wrote: On Thu, Jan 17, 2013 at 3:54 PM

Re: [sqlalchemy] How to handle 'sub-commits'?

2013-01-08 Thread Ken Lareau
On Tue, Jan 8, 2013 at 2:16 PM, Michael Bayer mike...@zzzcomputing.comwrote: On Jan 8, 2013, at 4:00 PM, Ken Lareau wrote: Given this and your previous comments, and after some conversations with a coworker, I decided to expose the 'engine' variable from the database library and create

Re: [sqlalchemy] How to handle 'sub-commits'?

2013-01-06 Thread Ken Lareau
Michael, Thanks for the response, see further questions/issues below... On Fri, Jan 4, 2013 at 8:41 AM, Michael Bayer mike...@zzzcomputing.comwrote: On Jan 3, 2013, at 10:18 PM, Ken Lareau wrote: I recently (today) ran into an issue that has me perplexed as to how to resolve it, so I'm

[sqlalchemy] How to handle 'sub-commits'?

2013-01-03 Thread Ken Lareau
give. -- - Ken Lareau -- 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

[sqlalchemy] Specifying descending order_by on a backref

2009-02-17 Thread Ken
am I missing? Thanks ahead of time. -Ken --~--~-~--~~~---~--~~ 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

[sqlalchemy] Re: Specifying descending order_by on a backref

2009-02-17 Thread Ken
On Feb 17, 3:13 pm, Michael Trier mtr...@gmail.com wrote: backref supports the same arguments as relation(), which include an order_by argument. http://www.sqlalchemy.org/docs/05/reference/orm/mapping.html?highligh... Michael, I'm using the order_by argument. The problem is that it's sorting

[sqlalchemy] Re: Specifying descending order_by on a backref

2009-02-17 Thread Ken
On Feb 17, 3:29 pm, Michael Trier mtr...@gmail.com wrote: Sorry, I misunderstood. You should be able to do a order_by=field.desc(). Ah, that answers my question. Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

[sqlalchemy] Re: New problem with synonym (getter/setter) use in 0.5.2

2009-02-04 Thread Ken
On Feb 4, 6:53 am, Michael Bayer mike...@zzzcomputing.com wrote: its not really a bug.   use real column objects for your order by   expression, i.e.: order_by=_username, Oh, that makes sense. Thanks for the explanation. -Ken --~--~-~--~~~---~--~~ You

[sqlalchemy] Re: New problem with synonym (getter/setter) use in 0.5.2

2009-02-03 Thread Ken
Oh, sorry, forgot to mention: Python 2.5.2 SQLAlchemy 0.5.2 --~--~-~--~~~---~--~~ 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

[sqlalchemy] Re: Vague InterfaceError (threading issue?) running normal query

2008-12-19 Thread Ken
I've created a full test case that should reproduce the error for you. You'll need to create a database called 'test' on your local machine. I think I've isolated the problem to the use of the creator keyword argument, which I use in my application for various reasons.

[sqlalchemy] Re: Vague InterfaceError (threading issue?) running normal query

2008-12-19 Thread Ken
Oh, I see. I was unaware that lambda evaluated the result only once, not each use. Thanks so much for your help. On Dec 19, 4:36 pm, Michael Bayer mike...@zzzcomputing.com wrote: def setup(**kwargs):      connection = MySQLdb.connections.Connection(**kwargs)      engine =

[sqlalchemy] Re: Vague InterfaceError (threading issue?) running normal query

2008-12-18 Thread Ken
On Dec 17, 9:24 am, Michael Bayer mike...@zzzcomputing.com wrote: yes but pool_recycle is documented as a number of seconds, and a   typical value is 3600 for one hour.  setting it to True means it will   recycle the connection every second.   Technically, that shouldn't   cause any broken

[sqlalchemy] Re: Vague InterfaceError (threading issue?) running normal query

2008-12-17 Thread Ken
16, 2008, at 1:09 PM, Ken wrote: I'm using CherryPy with SQLAlchemy. I've tried this with both SQLAlchemy's scoped_session thread-local sessions, as well as (also local-to-thread) sessions I create in my web code manually. 2008-12-16 11:51:14,524 DEBUG cherrypy.error.140068141119376

[sqlalchemy] Vague InterfaceError (threading issue?) running normal query

2008-12-16 Thread Ken
I'm using CherryPy with SQLAlchemy. I've tried this with both SQLAlchemy's scoped_session thread-local sessions, as well as (also local-to-thread) sessions I create in my web code manually. 2008-12-16 11:51:14,524 DEBUG cherrypy.error.140068141119376: [16/Dec/ 2008:11:51:14] HTTP Traceback (most

[sqlalchemy] Re: Access to AS/400 data

2008-05-20 Thread Ken Kuhlman
partitioning data with members. Once the alias is created, it can be treated like any other table. -ken --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy

[sqlalchemy] one-to-many access and modification

2007-09-28 Thread Ken Pierce
the list and return the object -- in which case, would the changes be reflected in the session / database? Thanks in advance, Most impressed so far, Ken Pierce. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy

[sqlalchemy] django + sqlalchemy = ?

2007-09-12 Thread Ken Kuhlman
. Was the original goal of the branch [1] too aggressive? Thanks in advance. -Ken [1] Integrating Django and SQLAlchemy, Aug 29, 2006: http://groups.google.com/group/django-developers/browse_thread/thread/5149e1c60dc65bff --~--~-~--~~~---~--~~ You received this message because you

[sqlalchemy] Re: save_or_update() with a unique but not primary key

2007-03-14 Thread Ken Kuhlman
Perhaps he's looking for an upsert function? That's sometimes handy, and to be truly useful would have to be able to use any given key on the table. I hacked up an upsert for SQLObject once, but it was so ugly I never contributed it. It did make the poor man's replication system that I was

[sqlalchemy] assign_mapper breaks polymorphic multi-table inheritance in 3.1?

2006-12-08 Thread Ken Kuhlman
sqlite. If it's true, then sqlite fails on the assertion that the manager employee id's be different, and postgres throws an exception that 'managers_person_id_seq does not exist' Thanks in advance for any help, and thanks for an otherwise awesome product! -Ken #!/usr/bin/env python