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,
> 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
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
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
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
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
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
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))
>>>
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.
--
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
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
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,
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 =
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
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
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
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
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
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:
> >
> >
>
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
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
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
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
> 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
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
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 =
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
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,
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,
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
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:
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
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.
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):
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
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
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
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
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__`
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
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
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,
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
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.
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:
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
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.
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,
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
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.
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
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))
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
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
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
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
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
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
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,
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
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
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
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
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
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
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
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
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
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
-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
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
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
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
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
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':
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 =
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 =
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 =
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
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 =
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
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
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,
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,
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
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),
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
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).
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
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
90 matches
Mail list logo