Re: [sqlalchemy] [Question] Why not passing Connection URL query parameters to the dialect?

2022-01-07 Thread nicolas...@jobteaser.com
Don't get me wrong, I only have praises for the work currently being done on removing all the `bind`. It was one of the things that had me confused with SQLAlchemy when I started working with it some years back and also caused me a few headaches. And honestly after weighing the pros and cons,

Re: [sqlalchemy] [Question] Why not passing Connection URL query parameters to the dialect?

2022-01-07 Thread Jonathan Vanasco
> Ok. So if I understand you correctly, you want to keep query parameters solely for DBAPI drivers connection parameters and would hence not accept a PR that would implement something that changes that. Just adding: the standard across programming languages and database products/projects is to

Re: [sqlalchemy] [Question] Why not passing Connection URL query parameters to the dialect?

2022-01-07 Thread Mike Bayer
also if you really want your app to have just one URL with all kinds of config in it, then just use that. get the URL object using the make_url() API, pull out the configuration you need from URL.query, make a new URL from that one that is for your database, then connect.it's all public

Re: [sqlalchemy] [Question] Why not passing Connection URL query parameters to the dialect?

2022-01-07 Thread Mike Bayer
the idea of Table objects being linked to a database is something I thought was a good idea in 2006, which is why for the last 15 years there's been this notion of "bound metadata" that associates a specific engine with Table objects. however, probably by 2009 if not earlier, the limited and

Re: [sqlalchemy] [Question] Why not passing Connection URL query parameters to the dialect?

2022-01-07 Thread nicolas...@jobteaser.com
Hi ! Ok. So if I understand you correctly, you want to keep query parameters solely for DBAPI drivers connection parameters and would hence not accept a PR that would implement something that changes that. There are other reasons though for which I was looking into this. In particular, what I

Re: [sqlalchemy] [Question] Why not passing Connection URL query parameters to the dialect?

2022-01-06 Thread Mike Bayer
hey there - database URLs do support query string parameters, however they have a specific meaning which is that they are consumed by the DBAPI in use, not the dialect directly. Please review the docs at

[sqlalchemy] [Question] Why not passing Connection URL query parameters to the dialect?

2022-01-06 Thread nicolas...@jobteaser.com
Hi ! While working on some improvements to PyAthena, I was looking into means to pass some parameters to the dialect. Going through the code of the ` create_engine()` function code, I saw that dialects `__init__()` where given dialect kwargs passed as kwargs

Re: [sqlalchemy] question :)

2020-10-09 Thread Mike Bayer
yes the tuple construct provides this: https://docs.sqlalchemy.org/en/13/core/sqlelement.html?highlight=tuple#sqlalchemy.sql.expression.tuple_ >>> from sqlalchemy import select, column, tuple_ >>> stmt = select([column('q')]).where(tuple_(column('x'), column('y')) == >>> tuple_(3, 4)) >>>

[sqlalchemy] question :)

2020-10-09 Thread Massimiliano della Rovere
Greetings, is it possible using sqlalchemy core to obtain the following code: [...] WHERE (column1, column2) = (value1, value2) this is useful to use multi columnar indexes having column1 and column2 in the two leftmost position and in later position columns that I put in the SELECT section. --

Re: [sqlalchemy] Question about connection pool by host instead of db

2019-01-28 Thread Mike Bayer
When you say shards it's not clear if you want per-shard connect points or if you are looking for a round robin distribution under one connect point. For the latter case, I did work up a new kind of connection pool which does this, which is at

[sqlalchemy] Question about connection pool by host instead of db

2019-01-27 Thread Carson Ip
Hi, is it possible to have the connection pool pooling connections by host instead of db? i.e. it will change db upon reuse. I'm asking because I have a lot of shards (databases) on every MySQL host and if I create a connection pool size of N, and the host contains M shards, it will create N*M

Re: [sqlalchemy] question about `association_proxy` interface

2018-10-03 Thread Mike Bayer
I would look to generalize the whole thing, e.g. auto-generate the *Metacontent class, as well as the association proxy (like a HasMetacontent mixin for Item), the assoc proxy can be genericized starting like this: class Item(Base): __tablename__ = 'item' id = Column(Integer,

[sqlalchemy] question about `association_proxy` interface

2018-10-02 Thread Jonathan Vanasco
I have a common design in my database in which the heavy write/update columns exist in their own 'metacontent' table. An `association_proxy` is used to link them: class Item(Base): __tablename__ = 'item' id = Column(Integer, primary_key=True) item_description =

Re: [sqlalchemy] Question about ShardedQuery Gevent parallelization

2018-08-23 Thread Carson Ip
Hi Mike, Thanks for your detailed reply and your work on sqlalchemy. When I was researching about the issue, I have already read your blog post about asyncio. It was very insightful. Let me briefly describe my setup. Benchmark setup: 2 MySQL database nodes, total 90 shards (databases). On

Re: [sqlalchemy] Question about ShardedQuery Gevent parallelization

2018-08-22 Thread Mike Bayer
On Wed, Aug 22, 2018 at 6:03 AM, Carson Ip wrote: > This is my first post here. > > Software / Library versions: (tho unrelated) > sqlalchemy version: 1.0.19 > db: MySQL 5.6 > db driver: mysqlclient 1.3.7 > > Background: > I have 6 databases with a total of hundreds of shards. I realize when I

[sqlalchemy] Question about ShardedQuery Gevent parallelization

2018-08-22 Thread Carson Ip
This is my first post here. Software / Library versions: (tho unrelated) sqlalchemy version: 1.0.19 db: MySQL 5.6 db driver: mysqlclient 1.3.7 Background: I have 6 databases with a total of hundreds of shards. I realize when I add more database hosts (and shards), my ShardedSession which

Re: [sqlalchemy] question on making a `text` element usable by the ORM?

2018-04-12 Thread Mike Bayer
don't do the alias and use query.from_statement() On Thu, Apr 12, 2018 at 6:30 PM, Jonathan Vanasco wrote: > I have a complicated recursive CTE that exists as text() > > _complex_sql_ = sqlalchemy.text("""WITH RECURSIVE _foos AS ( > SELECT id > FROM foo > WHERE

[sqlalchemy] question on making a `text` element usable by the ORM?

2018-04-12 Thread Jonathan Vanasco
I have a complicated recursive CTE that exists as text() _complex_sql_ = sqlalchemy.text("""WITH RECURSIVE _foos AS ( SELECT id FROM foo WHERE (id = :id_start AND ...) UNION SELECT f.id FROM foo f INNER JOIN _foos _f ON _f.id = f.id ) SELECT DISTINCT id FROM

Re: [sqlalchemy] question about test_integrity_error test

2017-10-19 Thread Gijs Molenaar
Op donderdag 19 oktober 2017 03:18:46 UTC+2 schreef Mike Bayer: > > On Wed, Oct 18, 2017 at 9:23 AM, Gijs Molenaar > wrote: > > hi! > > > > I'm trying to understand the intentions of this test better: > > > > >

Re: [sqlalchemy] Question about behavior of get_history for CompositeProperty

2017-02-07 Thread mike bayer
Hi there - Can't reproduce. Below is a complete test case, please modify it to illustrate how you are getting this result. from sqlalchemy import * from sqlalchemy.orm import * from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() class

[sqlalchemy] Question about behavior of get_history for CompositeProperty

2017-02-07 Thread Samer Atiani
Hello All, Assume you have a CompositeProperty that depends on two properties, 'property_1' and 'property_2' and assume the constructor method for this property class does something like this: class ExampleCompositeProperty(object): def __init__(self, property_1, property_2): if property_1 is

Re: [sqlalchemy] Question regarding detached object

2016-10-11 Thread Jonathan Vanasco
On Tuesday, October 11, 2016 at 9:06:33 AM UTC-4, Ludovic Beliveau wrote: > > Note that the code is specifying "expire_on_commit=False". >> > This suggests that you have a `commit` in your code. (If you can run the same block with `expire_on_commit=True`, then you probably just have a

Re: [sqlalchemy] Question regarding detached object

2016-10-11 Thread Ludovic Beliveau
Thanks Simon, no it is not using any framework, just bare sqlalchemy. /ludovic On Friday, October 7, 2016 at 9:47:45 AM UTC-4, Simon King wrote: > > > On 7 Oct 2016, at 14:33, Ludovic Beliveau > wrote: > > > > Hi, > > > > I know this subject has been covered many times

Re: [sqlalchemy] Question regarding detached object

2016-10-07 Thread Simon King
> On 7 Oct 2016, at 14:33, Ludovic Beliveau wrote: > > Hi, > > I know this subject has been covered many times in this group and I've read a > lot on it in the past few days. But there is still something that I can't > explain/understand with detached object. > > The

[sqlalchemy] Question regarding detached object

2016-10-07 Thread Ludovic Beliveau
Hi, I know this subject has been covered many times in this group and I've read a lot on it in the past few days. But there is still something that I can't explain/understand with detached object. The issue was happening very rarely, the error I was getting was: DetachedInstanceError: Parent

[sqlalchemy] Question about collection_class=ordering_list and Bullet.slide = slide

2016-09-23 Thread HP3
Hello all, In regards to ordering_list: http://docs.sqlalchemy.org/en/rel_0_9/orm/extensions/orderinglist.html from sqlalchemy.ext.orderinglist import ordering_list Base = declarative_base() class Slide(Base): __tablename__ = 'slide' id = Column(Integer, primary_key=True) name =

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

2016-06-14 Thread Mike Bayer
On 06/14/2016 11:28 AM, Ken Linehan wrote: Hello, I'm working with a class inheritance structure which can be illustrated by this example: | class Entity(object): def __init__(self, entity_type=EntityTypeEntity, id=None): self.entity_type = entity_type self.id = id

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

2016-06-14 Thread Ken Linehan
Hello, I'm working with a class inheritance structure which can be illustrated by this example: class Entity(object): def __init__(self, entity_type=EntityTypeEntity, id=None): self.entity_type = entity_type self.id = id class Person(Entity): def __init__(self,

[sqlalchemy] Question about the other property of backref

2016-02-24 Thread 尤立宇
Following the ORM tutorial of `User` and `Address`, if I configure a `user` attribute on `Address`: class Address(Base): __tablename__ = 'addresses' id = Column(Integer, primary_key=True) email_address = Column(String, nullable=False) user_id = Column(Integer,

[sqlalchemy] Question about FAQ entry titled "I’m getting a warning or error about “Implicitly combining column X under attribute Y”"

2015-09-08 Thread Piotr Dobrogost
Hi! In the FAQ there's entry titled "I’m getting a warning or error about “Implicitly combining column X under attribute Y”" with the following example: class A(Base): __tablename__ = 'a' id = Column(Integer, primary_key=True) class B(A): __tablename__ = 'b' # probably not

Re: [sqlalchemy] Question about FAQ entry titled "I’m getting a warning or error about “Implicitly combining column X under attribute Y”"

2015-09-08 Thread Richard Gerd Kuesters
is your "A" class abstract and/or are you using them with polymorphism? regards, richard. On 09/08/2015 07:00 AM, Piotr Dobrogost wrote: Hi! In the FAQ there's entry titled "I’m getting a warning or error about “Implicitly combining column X under attribute Y”" with the following example:

Re: [sqlalchemy] Question about FAQ entry titled "I’m getting a warning or error about “Implicitly combining column X under attribute Y”"

2015-09-08 Thread Piotr Dobrogost
On Tuesday, September 8, 2015 at 1:37:05 PM UTC+2, Richard Kuesters wrote: | is your "A" class abstract and/or are you using them with polymorphism? Thank you for taking time to look at this. If by abstract you mean abstract as defined at

Re: [sqlalchemy] Question about FAQ entry titled "I’m getting a warning or error about “Implicitly combining column X under attribute Y”"

2015-09-08 Thread Richard Gerd Kuesters
well, i'm sorry if i'm pouring could water on you but continuum never worked as expected (at least for me) and i always used history_meta for audit, which comes packaged with sqlalchemy as an example and is much more friendly if you need to add functionalities on your own :) cheers, richard.

Re: [sqlalchemy] Question about FAQ entry titled "I’m getting a warning or error about “Implicitly combining column X under attribute Y”"

2015-09-08 Thread Mike Bayer
On 9/8/15 6:00 AM, Piotr Dobrogost wrote: Hi! In the FAQ there's entry titled "I’m getting a warning or error about “Implicitly combining column X under attribute Y”" with the following example: class A(Base): __tablename__ = 'a' id = Column(Integer, primary_key=True) class B(A):

Re: [sqlalchemy] Question about FAQ entry titled "I’m getting a warning or error about “Implicitly combining column X under attribute Y”"

2015-09-08 Thread Piotr Dobrogost
On Tuesday, September 8, 2015 at 4:36:38 PM UTC+2, Richard Kuesters wrote: > > well, i'm sorry if i'm pouring could water on you but continuum never > worked as expected (at least for me) and i always used > Cold shower it is indeed :( Nevertheless thank you for your time and interest. I keep

Re: [sqlalchemy] question about `sqlalchemy.orm.mapper.Mapper` and objects

2015-07-23 Thread Jonathan Vanasco
Yeah, no error. I'll guess that: * My code isn't doing what I intended * but *SqlAlchemy isn't raising an error So I can work with that. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails

Re: [sqlalchemy] question about `sqlalchemy.orm.mapper.Mapper` and objects

2015-07-23 Thread Mike Bayer
On 7/23/15 3:04 PM, Jonathan Vanasco wrote: so does dbSession.expunge(relationship) when `relationship` is an item from `sqlalchemy.inspection.inspect(obj).mapper.relationships.values()` somehow expunge the object-specific relationship, or all relationships ? that should raise an

[sqlalchemy] question about `sqlalchemy.orm.mapper.Mapper` and objects

2015-07-23 Thread Jonathan Vanasco
This is an extension of my question about recursive object expunging (https://groups.google.com/forum/#!topic/sqlalchemy/lUhCDfkPc9k) Is the mapper that is accessed via `sqlalchemy.inspection.inspect(obj).mapper` and stored in `object.__mapper__` specific to the instance? I thought it was the

Re: [sqlalchemy] question about `sqlalchemy.orm.mapper.Mapper` and objects

2015-07-23 Thread Mike Bayer
On 7/23/15 2:28 PM, Jonathan Vanasco wrote: This is an extension of my question about recursive object expunging (https://groups.google.com/forum/#!topic/sqlalchemy/lUhCDfkPc9k) Is the mapper that is accessed via `sqlalchemy.inspection.inspect(obj).mapper` and stored in `object.__mapper__`

[sqlalchemy] question about race conditions

2013-12-05 Thread Jonathan Vanasco
i'm looking at moving some raw sql in twisted to SqlAlchemy and have a question. I have a multi-threaded twisted daemon that tends to generate a lot of race conditions on a few tables that are frequently hit. I get integrity errors from something like this : domain = SELECT * FROM

Re: [sqlalchemy] question about race conditions

2013-12-05 Thread Michael Bayer
On Dec 5, 2013, at 2:24 PM, Michael Bayer mike...@zzzcomputing.com wrote: On Dec 5, 2013, at 1:25 PM, Jonathan Vanasco jonat...@findmeon.com wrote: i'm looking at moving some raw sql in twisted to SqlAlchemy and have a question. I have a multi-threaded twisted daemon that tends to

Re: [sqlalchemy] question about race conditions

2013-12-05 Thread Jonathan Vanasco
oh that's great - I didn't expect SqlAlchemy to aggregate/support the different driver errors like that! thanks so much, Michael! -- 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,

Re: [sqlalchemy] question about race conditions

2013-12-05 Thread Julien Cigar
On Thu, Dec 05, 2013 at 10:25:46AM -0800, Jonathan Vanasco wrote: i'm looking at moving some raw sql in twisted to SqlAlchemy and have a question. I have a multi-threaded twisted daemon that tends to generate a lot of race conditions on a few tables that are frequently hit. I get

[sqlalchemy] Question about Enum

2013-11-05 Thread Richard Gerd Kuesters
Hi all! A simple question about enum http://docs.sqlalchemy.org/en/rel_0_9/core/types.html#sqlalchemy.types.Enum. In there, it says: native_enum -- Use the database's native ENUM type when available. Defaults to True. When False, uses VARCHAR + check constraint for all backends.

Re: [sqlalchemy] Question about Enum

2013-11-05 Thread Richard Gerd Kuesters
Well, nevermind, kinda dumb question. Managed to create other types myself. Kind regards, Richard. On 11/05/2013 02:29 PM, Richard Gerd Kuesters wrote: Hi all! A simple question about enum http://docs.sqlalchemy.org/en/rel_0_9/core/types.html#sqlalchemy.types.Enum. In there, it says:

[sqlalchemy] question about using SAVEPOINTS

2013-03-18 Thread alonn
from the docshttp://docs.sqlalchemy.org/en/latest/orm/session.html#using-savepoint : begin_nested()http://docs.sqlalchemy.org/en/latest/orm/session.html#sqlalchemy.orm.session.Session.begin_nested may be called any number of times, which will issue a new SAVEPOINT with a unique identifier for

Re: [sqlalchemy] question about using SAVEPOINTS

2013-03-18 Thread Michael Bayer
On Mar 18, 2013, at 4:22 PM, alonn alonis...@gmail.com wrote: from the docs: begin_nested() may be called any number of times, which will issue a new SAVEPOINT with a unique identifier for each call. For each begin_nested() call, a corresponding rollback() or commit() must be issued.

[sqlalchemy] Question PickledType usage

2013-03-12 Thread Zoltan Giber
Hi, I'm new to sqlalchemy, writing my first app using it. I stumbled upon a weird thing; my user object has a pyckletype representing a python dict, which i can't find a way to update. I assumed, that a change in the pickled object will somehow trigger dirty and my new data should be there,

Re: [sqlalchemy] Question PickledType usage

2013-03-12 Thread Matthew Desmarais
Hi Zoltan, On Tue, Mar 12, 2013 at 9:56 AM, Zoltan Giber zgi...@gmail.com wrote: I'm new to sqlalchemy, writing my first app using it. I stumbled upon a weird thing; my user object has a pyckletype representing a python dict, which i can't find a way to update. I assumed, that a change in

Re: [sqlalchemy] Question PickledType usage

2013-03-12 Thread Zoltan Giber
Thanks Matthew, I see that this would be a way, but I'm not very experienced, and introducing a new custom type feels like an overkill. I only have three pickletype in my whole app, and i don't mind to set dirty manually when I update them. I don't want to query against their values either.

Re: [sqlalchemy] Question PickledType usage

2013-03-12 Thread Michael Bayer
if you want to do this manually, just reassign to the attribute which will trigger it: myobject.mypickle = {dictionary} the mutation thing is only if you want in-place tracking, that is: myobject.mypickle['newvalue'] = 'something' On Mar 12, 2013, at 11:15 AM, Zoltan Giber zgi...@gmail.com

Re: [sqlalchemy] Question PickledType usage

2013-03-12 Thread Zoltan Giber
Thanks Michael, that did the trick. Using the mutable thing is only a small comfort in my case compared to the extra design it takes. for the sake of completeness here is what works: newuser = User(email,name,password) newuser.notebooks.append(Notebook(My Notes))

[sqlalchemy] Question about Selecting with an Association Pattern

2012-02-24 Thread Jonathan Vanasco
I have a question about the Association Pattern http://docs.sqlalchemy.org/en/latest/orm/relationships.html#association-object I have a structure as such: useraccount group useraccount_2_group ( useraccount_id , group_id , metadata like relation type / date / etc ) Is it

[sqlalchemy] Question about mutable primary keys and foreign keys

2012-02-06 Thread Michael Naber
I am trying to efficiently update all things that foreign key to a particular record so that they instead foreign key to a different record. I provided an example that illustrates the problem I am trying to solve. Please see my question at the bottom of the code. Thanks for your help, Michael

Re: [sqlalchemy] Question about mutable primary keys and foreign keys

2012-02-06 Thread Michael Bayer
On Feb 6, 2012, at 12:39 PM, Michael Naber wrote: I am trying to efficiently update all things that foreign key to a particular record so that they instead foreign key to a different record. I provided an example that illustrates the problem I am trying to solve. Please see my question at

Re: [sqlalchemy] Question on session.expunge.all()

2011-09-07 Thread Vlad K.
Great, thanks! .oO V Oo. On 09/06/2011 04:48 PM, Michael Bayer wrote: On Sep 6, 2011, at 10:40 AM, Vlad K. wrote: I have a products database which is daily syncronized with an external source via a csv file. There are several thousand rows in question. The synchronization does two

[sqlalchemy] Question on session.expunge.all()

2011-09-06 Thread Vlad K.
I have a products database which is daily syncronized with an external source via a csv file. There are several thousand rows in question. The synchronization does two things: 1. Update only price if changed for existing products 2. Insert new products if they don't exist with all fields

Re: [sqlalchemy] Question on session.expunge.all()

2011-09-06 Thread Michael Bayer
On Sep 6, 2011, at 10:40 AM, Vlad K. wrote: I have a products database which is daily syncronized with an external source via a csv file. There are several thousand rows in question. The synchronization does two things: 1. Update only price if changed for existing products 2. Insert

[sqlalchemy] Question about Many to One relationship

2011-09-01 Thread Geo
I have tables which linked as a one to many relationship: user ---(one to many)--- order --(many to one)--product Product has been populated and served as a lookup table. class User: member_id purchase_total order = relationship(Order) def add_product(self,

Re: [sqlalchemy] Question about @validates decorator

2011-07-29 Thread Stefano Fontanelli
Il 28/07/11 21.17, Michael Bayer ha scritto: h well there's not a public API for that. Right now (and with no immediate plans to change it) the function should have an attribute called __sa_validators__ which is a list of attribute names.Ultimately there are attribute events assigned

Re: [sqlalchemy] Question about @validates decorator

2011-07-29 Thread Michael Bayer
On Jul 29, 2011, at 8:34 AM, Stefano Fontanelli wrote: Il 28/07/11 21.17, Michael Bayer ha scritto: h well there's not a public API for that. Right now (and with no immediate plans to change it) the function should have an attribute called __sa_validators__ which is a list of

[sqlalchemy] Question about @validates decorator

2011-07-28 Thread Stefano Fontanelli
Hi folks, I'm working on a project which uses SQLAlchemy as ORM layer and I have a question about @validates decorator. How can I get a list of functions (in each entity of my model) that are decorated using sqlalchemy.orm.validates decorator? Regards, Stefano. -- You received this

Re: [sqlalchemy] Question about @validates decorator

2011-07-28 Thread Michael Bayer
h well there's not a public API for that. Right now (and with no immediate plans to change it) the function should have an attribute called __sa_validators__ which is a list of attribute names.Ultimately there are attribute events assigned though the event API doesn't have a

[sqlalchemy] Question on the precedence of insert and delete in session flush

2011-07-27 Thread ammar azif
Hi, I am using SQLAlchemy 0.6.4 with postgres db. I have two tables - users and addresses tables with addresses table having a foreign key constraint referencing the users table. Each address record is identified by a unique constraint key 'email_address'. In my test case, each user instance have

Re: [sqlalchemy] Question on the precedence of insert and delete in session flush

2011-07-27 Thread Michael Bayer
On Jul 27, 2011, at 3:34 AM, ammar azif wrote: Hi, I am using SQLAlchemy 0.6.4 with postgres db. I have two tables - users and addresses tables with addresses table having a foreign key constraint referencing the users table. Each address record is identified by a unique constraint key

Re: [sqlalchemy] Question on the precedence of insert and delete in session flush

2011-07-27 Thread Mike Conley
And the recipe I have used is to issue a flush() after the deletes and before the inserts. In most cases this is sufficient to get things to work in the right order. I can imagine that there are some complex data management use cases where that is not sufficient. It works for your sample as the

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

2011-07-19 Thread ammar azif
Hi, The code that I am working on deletes rows from table A that are based on a certain query and then recreates these rows based on entries supplied by a csv file. Table A is referenced by table B. My question is, how does sql alchemy manage inserts and deletes in a transaction and it what order

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

2011-07-19 Thread King Simon-NFHD78
ammar azif wrote: Hi, The code that I am working on deletes rows from table A that are based on a certain query and then recreates these rows based on entries supplied by a csv file. Table A is referenced by table B. My question is, how does sql alchemy manage inserts and deletes in a

[sqlalchemy] question re using the session object

2011-06-14 Thread robert rottermann
hi there, for a zope website I am using sqlalchemy. Now I am unsure how to use the session object. What I do now is: from sqlalchemy.orm import scoped_session ... Session = scoped_session(session_factory, scopefunc) session = Session() this session object I import into all classes where ever I

RE: [sqlalchemy] question re using the session object

2011-06-14 Thread King Simon-NFHD78
-Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalchemy@googlegroups.com] On Behalf Of robert rottermann Sent: 14 June 2011 10:53 To: sqlalchemy@googlegroups.com Subject: [sqlalchemy] question re using the session object hi there, for a zope website I am using

[sqlalchemy] Question about how session works in SQLAlchemy

2010-12-28 Thread ammar azif
Hi, Attached is a simple script that inserts a record using Table.insert().execute() method and session.execute(Table.insert()). When I tried running session.execute(Table.select()), both records inserted by Table.insert().execute() and session.execute(Table.insert()) are retrieved, but when I

Re: [sqlalchemy] Question about how session works in SQLAlchemy

2010-12-28 Thread Michael Bayer
On Dec 28, 2010, at 2:56 AM, ammar azif wrote: Hi, Attached is a simple script that inserts a record using Table.insert().execute() method and session.execute(Table.insert()). When I tried running session.execute(Table.select()), both records inserted by Table.insert().execute() and

[sqlalchemy] question about urls when creating engine

2010-05-13 Thread Faheem Mitha
Hi, In http://www.sqlalchemy.org/docs/05/reference/sqlalchemy/connections.html#creating-engines it describes how permitted urls are of the form dialect://user:passw...@host/dbname[?key=value..], I'm using postgresql. I believe sqlalchemy uses psycopg2 by default. I've been connecting using

Re: [sqlalchemy] question about urls when creating engine

2010-05-13 Thread Michael Bayer
On May 13, 2010, at 7:33 AM, Faheem Mitha wrote: Hi, In http://www.sqlalchemy.org/docs/05/reference/sqlalchemy/connections.html#creating-engines it describes how permitted urls are of the form dialect://user:passw...@host/dbname[?key=value..], I'm using postgresql. I believe

[sqlalchemy] Question Using MySQL Function Encode

2009-08-28 Thread Tim
I have a small project I am trying to finish and I ran into a hiccup. I saw the sqlachemy.sql.func object and decided to try to use it. Here is the code to get us on the same page. userPassword = 'thisisasalt'; insertDictionary = [{ 'user_name': user_name, 'user_pwd':

[sqlalchemy] Question about joins and how the data is returned by the Query class

2009-07-14 Thread The Devil's Programmer
In my controller I have: query = session.query(Article, Category, User, UserVote) query = query.outerjoin((UserVote, and_ (Article.id==UserVote.article_id, UserVote.voter==currently_logged_in_user))) query = query.outerjoin((Category, Article.category_id == Category.id)) query =

[sqlalchemy] Question about joins and how the data is returned by the Query class

2009-07-14 Thread The Devil's Programmer
In my controller I have: query = session.query(Article, Category, User, UserVote) query = query.outerjoin((UserVote, and_ (Article.id==UserVote.article_id, UserVote.voter==currently_logged_in_user))) query = query.outerjoin((Category, Article.category_id == Category.id)) query =

[sqlalchemy] question on using not_

2009-01-23 Thread robert rottermann
Hi there, I have a table tblPerson that has a m:n relation with a table tblFlag using an association table tblCompany_has_Flag now I would like to find all persons, that do not have assigned any of list of flags. what I have tried among other things is the following: s =

[sqlalchemy] question re query vs select

2009-01-04 Thread robert rottermann
hi there I have a class tblMembershiptypeTable which I defind using declarative notation now I wold like to issue a query that returns instances of this class session.query(tblMembershiptypeTable).filter_by(name=mtype).all()[0] works as expected. whereas t = tblMembershiptypeTable.__table__ mt

[sqlalchemy] question regarding aliases in ORM, within an expression

2008-12-15 Thread Moshe C.
Table T has a self referential parent_id column. 'parent' is an orm.relation using that column. I have the following code which obviously does not work myquery = T.query() myquery = myquery.outerjoin('parent', aliased=True) myquery = myquery.reset_joinpoint() myquery =

[sqlalchemy] Question on SqlSoup

2008-08-30 Thread Shawn Church
I was playing with SqlSoup in preparation to use it in a new (production) project (sqlalchemy version 0.5.0beta3). I was testing with MySQL InnoDB tables. The SqlSoup wiki page, and source code docstring, imply that a SqlSoup.flush() will commit the data. I quickly realized that this is NOT

[sqlalchemy] Question about when to use connection pooling

2008-07-25 Thread Bram Avontuur
Hi, I'm currently developing a web application using TurboGears which makes use of sqlalchemy (0.4.6). Turbogears exposes a global 'session' object, which is initialised as scoped_session(sqlalchemy.orm.create_session()). E.g. each thread gets its own session object. Other web-accessible

[sqlalchemy] question

2008-07-18 Thread Vladimir Iliev
hi, i have a method that returns list of (material, thickness) groups which looks like: C = [order_element_items.c.material_uuid, materials.c.name, order_element_items.c.thickness] S = select( C,

[sqlalchemy] Question: mapping a complex SQL instruction as a relation

2008-01-28 Thread Stefano Bartaletti
Hello, I have two tables defined this way: tabItems = sqa.Table(meta, items, sqa.Column(id, sqa.Integer, primary_key=True), ) tabTracking = sqa.Table(meta, tracking, sqa.Column(id, sqa.Integer, primary_key=True), sqa.Column(item_id, sqa.Integer,

[sqlalchemy] Question about using python expressions to create a GIS query

2007-12-10 Thread Allen Bierbaum
I am trying to figure out how to best use SA to create a GIS query. In my application I am actually using ORM objects and mappers, but to keep my question focused on clauses and python expressions, I am just trying to test this out without the ORM first. The SQL query I would like to generate is

[sqlalchemy] Question about an ORM query with an aggregate function

2007-12-07 Thread Allen Bierbaum
I am trying to create two queries with some of my SA ORM objects that will use the sum of a field found through a relationship. To be a bit more concrete, here is a simple setup similar to mine. # table object users_table = Table('users', meta, Column('user_id', Integer, primary_key=True),

[sqlalchemy] Question regarding an adjacency-tree example in svn repo

2007-11-13 Thread bob
Hi, I am going over this this example to learn how to construct an eager- loaded adjacency tree, http://www.sqlalchemy.org/trac/browser/sqlalchemy/trunk/examples/adjacencytree/byroot_tree.py and I noticed that some of the keys in the treenodes table are given long names in the table

[sqlalchemy] question about unicode usage.

2007-10-17 Thread dykang
I have a question about inconsistency in unicode handling when using a bindparam explicitly and when using a literal when constructing my query. It appears that if I use a unicode object in the actual query whereclause, the convert_bind_param function of the base String will get called(query1).

[sqlalchemy] Question about queries and operators

2007-08-09 Thread mattrussell
Hi, related to my recent post on subclassing Column: The problem I have is that the right tables are not appearing in the FROM list in the query. I have overriden the 'in_' operatror on the column. When calling 'all()' on my query instance, I get the result back as I expected, but when calling

[sqlalchemy] Question about overriding properties

2007-04-26 Thread Barry Hart
In our application's Order table, we have foreign-key fields which reference the persons who placed the order, are responsible for fulfilling the order, etc. For reporting speed, the Order table holds denormalized copies of contact information for these people. Whenever one of the foreign keys