Excellent. As always, thanks very much for your time and answers (let
alone awesome software)!
On Wed, Jan 27, 2021 at 1:25 PM Mike Bayer wrote:
>
>
> On Tue, Jan 26, 2021, at 9:01 PM, Kent Bower wrote:
>
> Thanks a ton for your responses.
>
> Do all the normal columns of an aliased class
On Tue, Jan 26, 2021, at 9:01 PM, Kent Bower wrote:
> Thanks a ton for your responses.
>
> Do all the normal columns of an aliased class need to match the ad-hoc select
> to which I map the alias?
handwavy handwavy sort of yes, sort of no?there needs to be a 1-1
correspondence of
Thanks a ton for your responses.
Do all the normal columns of an aliased class need to match the ad-hoc
select to which I map the alias?
> oh if the class doesn't have a mapper, then defintiely, just make ad-hoc
subclasses of it and map to those.vastly easier that way.
Mapping to a subclass
On Tue, Jan 26, 2021, at 7:31 PM, Kent Bower wrote:
> I should have given these details from the get-go: the use case is a
> specialized select() (dynamically built) which would be extremely convenient
> to map relationships against for convenience in subquery loading, etc. So,
> the class
On Tue, Jan 26, 2021, at 7:31 PM, Kent Bower wrote:
> I should have given these details from the get-go: the use case is a
> specialized select() (dynamically built) which would be extremely convenient
> to map relationships against for convenience in subquery loading, etc. So,
> the class
I should have given these details from the get-go: the use case is a
specialized select() (dynamically built) which would be extremely
convenient to map relationships against for convenience in subquery
loading, etc. So, the class would not already have a mapper. Can I pass
non_primary=True
On Tue, Jan 26, 2021, at 3:16 PM, Kent wrote:
> Question: if I add a mapper to a class that is only needed temporarily, does
> using the mapper compile it along side my "normal" mappers such that I'll
> leak memory when I mean for the class to be garbage collected?
>
> Put another way, can I
Question: if I add a mapper to a class that is only needed temporarily,
does using the mapper compile it along side my "normal" mappers such that
I'll leak memory when I mean for the class to be garbage collected?
Put another way, can I add a mapper to a class that doesn't influence my
"main
Yes, it works.
I'm grateful for your help :)
ср, 25 окт. 2017 г. в 16:56, Mike Bayer :
> On Wed, Oct 25, 2017 at 9:25 AM, Антонио Антуан
> wrote:
> > As I said befire, sqlalchemy version: 1.0.19 and code is here:
> >
On Wed, Oct 25, 2017 at 9:25 AM, Антонио Антуан wrote:
> As I said befire, sqlalchemy version: 1.0.19 and code is here:
> https://gist.github.com/aCLr/113ac292c05bdb01e964d8e9884d6e5f
I apologize, did not see that link.
Use the execute_and_instances() implemenation from
As I said befire, sqlalchemy version: 1.0.19 and code is here:
https://gist.github.com/aCLr/113ac292c05bdb01e964d8e9884d6e5f
Currently I can't use another version. In that case, I think that here is
the right decision:
"Looks like I have to check if "_mapper_zero()" returns real mapper.
Otherwise
On Wed, Oct 25, 2017 at 6:52 AM, Антонио Антуан wrote:
> Any news here?
We would require a self-contained demonstration case that illustrates
your error as well as complete information on what specific SQLAlchemy
version you are targeting. As mentioned in a different reply,
On Wed, Oct 25, 2017 at 8:02 AM, Антонио Антуан wrote:
> Looks like I have to check if _mapper_zero() returns real mapper.
_mapper_zero() in the 1.1 and 1.2 series will never return a
non-mapper (see https://bitbucket.org/zzzeek/sqlalchemy/issues/3608).
I would strongly
This is complete guesswork - I haven't examined this code in detail so
I could be wrong. Also, I don't know what version of SQLAlchemy you
are using, so this may not apply.
Session.connection takes separate "mapper" and "clause" parameters:
Looks like I have to check if _mapper_zero() returns real mapper. Otherwise
I should pass None to "_connection_from_session()" as value of "mapper"
argument. Right?
ср, 25 окт. 2017 г. в 15:00, Антонио Антуан :
> As I mentioned before, " group_getter>".
>
> ср, 25 окт. 2017
As I mentioned before, "".
ср, 25 окт. 2017 г. в 14:19, Simon King :
> What does self._mapper_zero() return in your
> RoutingQuery._execute_and_instances method?
>
> Simon
>
> On Wed, Oct 25, 2017 at 11:52 AM, Антонио Антуан
> wrote:
> > Any news
What does self._mapper_zero() return in your
RoutingQuery._execute_and_instances method?
Simon
On Wed, Oct 25, 2017 at 11:52 AM, Антонио Антуан wrote:
> Any news here?
>
> суббота, 21 октября 2017 г., 18:42:47 UTC+3 пользователь Антонио Антуан
> написал:
>>
>> I see that it
Any news here?
суббота, 21 октября 2017 г., 18:42:47 UTC+3 пользователь Антонио Антуан
написал:
>
> I see that it is not happened when "bind" passed directly to
> "sessionmaker"
>
> сб, 21 окт. 2017 г. в 18:33, Антонио Антуан :
>
>>
>>
>> пятница, 20 октября 2017 г.,
I see that it is not happened when "bind" passed directly to "sessionmaker"
сб, 21 окт. 2017 г. в 18:33, Антонио Антуан :
>
>
> пятница, 20 октября 2017 г., 20:50:52 UTC+3 пользователь Mike Bayer
> написал:
>
>> On Fri, Oct 20, 2017 at 11:05 AM, Simon King
пятница, 20 октября 2017 г., 20:50:52 UTC+3 пользователь Mike Bayer написал:
>
> On Fri, Oct 20, 2017 at 11:05 AM, Simon King > wrote:
> > The "is not None" is important when checking a variable that may
> > contain a ClauseElement, precisely because ClauseElement
On Fri, Oct 20, 2017 at 11:05 AM, Simon King wrote:
> The "is not None" is important when checking a variable that may
> contain a ClauseElement, precisely because ClauseElement defines that
> __bool__ method.
>
> However, in Session.get_bind(), "mapper" is not supposed to
The "is not None" is important when checking a variable that may
contain a ClauseElement, precisely because ClauseElement defines that
__bool__ method.
However, in Session.get_bind(), "mapper" is not supposed to contain a
ClauseElement. It should either be an instance of
Really, `mapper` contains this: . But does it changes something? I already
encountered this problem in my code, when I checked sqla-objects existance
without "is not None", project was broken. Is it normal to omit that
condition in sqlalchemy code?
I use:
>>> sqlalchemy.__version__
'1.0.19'
On Fri, Oct 20, 2017 at 2:15 PM, Антонио Антуан wrote:
> Hi.
> I use my own `RoutingSession` and `RoutingQuery` implementation, most of it
> inspired by `sqlalchemy.ext.horizontal_shard`:
>
> class RoutingSession(Session):
> def get_bind(self, mapper=None, clause=None,
Hi.
I use my own `RoutingSession` and `RoutingQuery` implementation, most of it
inspired by `sqlalchemy.ext.horizontal_shard`:
class RoutingSession(Session):
def get_bind(self, mapper=None, clause=None, shard_id=None, **kwargs):
original_bind = None
try:
On Jul 24, 2013, at 12:13 PM, Dennis Backhaus backha...@moxieinformatics.com
wrote:
I have following table:
class Group(DeclarativeBase):
Group definition
Only the ``group_name`` column is required.
__tablename__ = 'tg_group'
id = Column(Integer,
I have following table:
class Group(DeclarativeBase):
Group definition
Only the ``group_name`` column is required.
__tablename__ = 'tg_group'
id = Column(Integer, autoincrement=True, primary_key=True)
group_name = Column(Unicode(16), unique=True, nullable=False)
I just got really confused. I have code that does
...join(schema.MappedClass.relation), and it works. But I had other code
that did foo = schema.MappedClass.relation, and it didn't work because
'relation' wasn't there.
The fix is to call orm.configure_mappers(), which happens by magic at
On Jun 12, 2013, at 8:46 PM, Andy aml...@gmail.com wrote:
I just got really confused. I have code that does
...join(schema.MappedClass.relation), and it works. But I had other code
that did foo = schema.MappedClass.relation, and it didn't work because
'relation' wasn't there.
The fix
.
Unfortunately, there are still errors displayed. Most of the time I
found 'Mapper' object has no attribute '_props'.
I also tried to use the standard SQLAlchemy mapper() function instead
of our wrapper mentioned in my first message (a variant of [1]). In most
cases the system complained about
after server startup, as often as initial processes are
configured.
Unfortunately, there are still errors displayed. Most of the time I found
'Mapper' object has no attribute '_props'.
I also tried to use the standard SQLAlchemy mapper() function instead of our
wrapper mentioned in my first
Could it be I am not loading enough modules? Does all modules mean
all modules of the application, or all modules to map successfully?
yes the issue is very likely that more modules are being imported
within non-main threads, and more mappers are coming in. if you get
absolutely every
Hello,
is there a problem in mapping classes to selects ([1]) /within a
function/? We are running into mapper errors reading
InvalidRequestError: One or more mappers failed to compile.
Exception was probably suppressed within a hasattr() call. Message was:
One or more mappers failed to
On May 9, 2012, at 8:10 PM, Jochen Stenzel wrote:
Hello,
is there a problem in mapping classes to selects ([1]) /within a function/?
with multiple threads, where the mappers initialization may first proceed as
the product of a thread running, yes. you'd want to upgrade to 0.7 for the
On Wed, May 9, 2012 at 4:11 PM, Michael Bayer mike...@zzzcomputing.com wrote:
Hello,
is there a problem in mapping classes to selects ([1]) /within a function/?
with multiple threads, where the mappers initialization may first proceed as
the product of a thread running, yes. you'd want
I'm new to SQLAlchemy. I wrote a method that retrieves a record,
update the object after incrementing it by 1, and return that record
object to the caller (pyramid view). Following is the test function. I
get following errors :
1) when I call this method multiple times, I get an error that say
You're best starting with the declarative usage patterns described in the ORM
tutorial at http://www.sqlalchemy.org/docs/orm/tutorial.html, starting with
http://www.sqlalchemy.org/docs/orm/tutorial.html#creating-table-class-and-mapper-all-at-once-declaratively.
I would declare the class +
Hi,
I have a join between 2 tables (User/Adresses, complete code below). I create a
mapper as
the join of the 2 classes as:
m = orm.mapper(Join, User.__table__.outerjoin(Address.__table__) ,
properties = {
'j_id' : [Address.__table__.c.user_id,
On Oct 31, 2010, at 9:05 AM, Alessandro Dentella wrote:
Hi,
I have a join between 2 tables (User/Adresses, complete code below). I create
a mapper as
the join of the 2 classes as:
m = orm.mapper(Join, User.__table__.outerjoin(Address.__table__) ,
properties = {
I'm looking for a way to set up a mapper like in this sqlalchemy
example:
class User(object):
pass
class Address(object):
pass
mapper(Address, addresses_table)
mapper(User, users_table, properties={
'boston_addresses': relation(Address, primaryjoin=
I was trying to add an AttributeExtension to a property from my
MapperExtension but I get this error when trying to access the
property:
AttributeError: 'Mapper' object has no attribute '_props'
Here's a test case:
from sqlalchemy import create_engine, Column
from sqlalchemy.ext.declarative
When introspecting a mapper, we can figure out the class type of its
properties like this:
For ColumnProperty:
prop.columns[0].type.__class__
For RelationProperty (relationship):
prop.argument
For RelationProperty (backref):
prop.argument.class_
How do I determine the class type a
On 4/28/2010 11:31 PM, Mark wrote:
Hi guys,
I have the following Table construction:
ADMIN_TABLE = Table('admin',
bound_meta_data,
Column('username', types.VARCHAR(100),
primary_key=True),
autoload=True,
Mark wrote:
sqlalchemy.exc.ArgumentError: Mapper Mapper|Admin|admin could not
assemble any primary key columns for mapped table 'admin'
As you can see above, I have already mapped the primary_key=True
property, why is it still complaining that it can't find the primary
key? With this error,
Hi guys,
I have the following Table construction:
ADMIN_TABLE = Table('admin',
bound_meta_data,
Column('username', types.VARCHAR(100),
primary_key=True),
autoload=True, schema=schema)
and a mapper as such:
On Apr 23, 2010, at 11:29 AM, Jason Baker jba...@zeomega.com wrote:
Given an entity class (or entity instance), I'd like to get the
table that is mapped to it. If I get the mapper using object_mapper/
class_mapper, then I get a mapper with the following properties
defined (among
Given an entity class (or entity instance), I'd like to get the table that
is mapped to it. If I get the mapper using object_mapper/class_mapper, then
I get a mapper with the following properties defined (among others):
local_table, mapped_table, and tables. Can someone help me understand what
Tan Yi wrote:
Hello. Recently I have been working on this environment:
linux + pyodbc + sqlalchemy 5.8 + ms sql server.
In the program, I try to build a mapper from a db table to my python
class, then I instatiate the class, and try to use session.add() to
insert record to database.
Hello. Recently I have been working on this environment:
linux + pyodbc + sqlalchemy 5.8 + ms sql server.
In the program, I try to build a mapper from a db table to my python
class, then I instatiate the class, and try to use session.add() to
insert record to database.
However, I need to have
Hi
I'm having trouble with define mapper for class which will include
data from more than 2 tables (I'm using Formalchemy for form
generation).
Quick brieffing on my model:
# account table
acc_account_table = sa.Table('acc_account', meta.metadata,
sa.Column('account_id', sa.types.Integer,
Hi,
docs suggests (Mapping a Class against Multiple Tables) to build a mapper
as this:
class AddressUser(object): pass
j = join(users_table, addresses_table)
mapper(AddressUser, j, properties={
'user_id': [users_table.c.user_id, addresses_table.c.user_id]
})
On Dec 9, 2009, at 3:16 PM, Alessandro Dentella wrote:
Hi,
docs suggests (Mapping a Class against Multiple Tables) to build a mapper
as this:
class AddressUser(object): pass
j = join(users_table, addresses_table)
mapper(AddressUser, j, properties={
'user_id':
Hi all,
There anyway to keep the ordering of properties defined on a mapper?
The reason I ask is that I'm building a tabbed interface consiting of
a parent form and multiple related child forms and I'd like the tabs
to be in the same order that I've defined the properies on the parent
mapper:
What is the best way to map several columns from one table to another
table? Let's say I have two classes: LargeComplicatedClass and
AnotherClass.
LargeComplicatedClass which is has a lot of eager loads and columns
with a lot of data, which is expensive to query.
I also have a AnotherClass to
naktinis wrote:
What is the best way to map several columns from one table to another
table? Let's say I have two classes: LargeComplicatedClass and
AnotherClass.
LargeComplicatedClass which is has a lot of eager loads and columns
with a lot of data, which is expensive to query.
I also
Hello everyone,
I have a concrete question about using declarative mapper in my
project.
There are three tables: user, services and objects
Class Services(Base):
user_id = Column(user_id, Integer, ForeignKey
(user_table.user_id))
..
Class Objects(Base):
user_id =
Hello everyone,
I have a concrete question about using declarative mapper in my
project.
There are three tables: user, services and objects
Class Services(Base):
user_id = Column(user_id, Integer, ForeignKey
(user_table.user_id))
..
Class Objects(Base):
user_id =
Hello everyone,
I have a concrete question about the declarative mapper in my project.
There are three tables: user, services and objects
Class Services(Base):
mote_id = Column(mote_id, Integer, ForeignKey
(mote_table.mote_id))
Class Objects(Base):
mote_id = Column(mote_id,
Hello everyone,
I have a concrete question about using declarative mapper in my
project.
There are three tables: user, services and objects
Class Services(Base):
user_id = Column(user_id, Integer, ForeignKey
(user_table.user_id))
..
Class Objects(Base):
user_id =
I have a project where I need to monitor the changes to a record -
when using after_update, is it possible to see what the data was
before the update?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
noload should be same as lazyload, eagerload.
on sa0.4, noload has no mapper arg.
why in 0.5 the mapper argn is gone in all of them?
it is needed when query-row is of two or more entities
--~--~-~--~~~---~--~~
You received this message because you are subscribed
Sorry for the subject, I wasn't able to find a good one.
I'd like to have 2 differente attribute of python to be mapped in one
sql column.
e.g.:
person_table = Table('person', metadata
,Column('id', Integer, primary_key=True)
)
class Person(object):
pass
and I'd like to do something
I am looking for a hook after a instance has been created, attribute
populated and any initialization done. I have found populate_instance
in the MapperExtension. It look like to close thing.
Adding a hook to MapperExtension for after instance is created,
populated, and any initialization by the
Hey All,
I was upgrading our app from 0.4.1 to 0.4.5 and this code broke:
pg_user = Table('pg_user', metadata,
Column('usesysid', Integer, primary_key=True),
Column('usename', Unicode(), unique=True))
pg_group = Table('pg_group', metadata,
Column('grosysid', Integer,
Hi all,
I've got a situation where I want to use inherited mappers, with joins
to other inherited mappers. However I'm getting some weird results
where the following query should show no cat objects, instead I get 2
back for both queries.
Can anyone spot the flaw in my code here ?
The api and
Hi all,
I have a situation where I want to declare a relation between two
tables, but I want to be able to run a callback whenever I append to
that relation. Here's an example
class Kennel:
def callback(self, o):
print callback, o
mapper = Mapper(
Kennel,
kennelTable,
Just noticed that for mappers that use tables that do not define foreign
keys, specifying only 'primaryjoin=' plus 'foreign_keys=' doesn't seem to
be sufficient to define the relationship, adding 'remote_side=' fixed it.
Also for such mappers, if there is a 'backref', the backref doesn't seem to
g'day.
in the Aggregator i have mapper extension, that needs info from the
mapper like local-table and mapping/naming of column properties.
It used to hook on instrument_class() for that, but now the
mapper.properties in its new get()/iterate() form is not
available yet when mapper-extensions
Hi everyone!
I'm new in SQLAlchemy and this is my code:
mappers['indicatorgroups'] = mapper(IndicatorGroups, tables['indicatorgroups'])
mappers['groupgroups'] = mapper(GroupGroups, tables['groupgroups'],
properties = {
'idindicatorgroupcontainer' :
Sorry for the confusing subject. If I map against a select in which
one of the tables has a foreign key whose default value is set to a
clause involving another table's column (also in the select), and that
column is labeled, the correct values are inserted, but an exception
is raised when
I have a case where SA 0.3.8 create wrong SQL code and an unneeded and
unwanted
INSERT statement. My code inserts a new Arbeitsmittel into the DB using:
Arbeitsmittel = wrapper.getMapper('arbeitsmittel')
d = {'hidx' : hidx,
'zodb_path' : zodb_path,
'versionsnr' : 0,
Dear list...
I'm having trouble with two assign-mappers with a custom JOIN condition.
(And I admit that I'm not yet good at that in SQLAlchemy. So be gentle.)
powerdns_records_table = Table(
'records', meta,
Column('id', Integer, primary_key=True),
Column('name', Unicode(80)),
Hello again!
I need a mapper that does an outer join on another table.
stock_request_join = sql.outerjoin(request_table, stock_table, and_(
request_table.c.id_item==stock_table.c.id_product,
request_table.c.id_location==stock_table.c.id_location,
Hello,
I have a question regarding using a mapper to add a relation to a
mapped class using instance attributes (not contained in the mapped
classes table def) on the mapped class control the select statement
for the join.
For example:
my Calendar class has a relation to CalendarEvent
74 matches
Mail list logo