Hi everyone
Looking for some grey beard opinion.
I recently came across Alistair Cockburn's Hexagonal architecture, aka.
ports and adapters.
http://blog.8thlight.com/uncle-bob/2012/08/13/the-clean-architecture.html
The names are dubious but the basic idea is not new: separate the domain
Hello all
Tried for hours to figure out the various relationship() options with no
luck.
Consider:
class Enrolment(base):
__tablename__ = 'enrolment'
person_id = Column(String, primary_key=True)
group_id= Column(String, primary_key=True)
enrol_date = Column(Date,
(Enrolment.next_date) == None))
),
uselist=False,
viewonly=True)
On Thursday, 15 August 2013 04:30:12 UTC+10, avdd wrote:
Hello all
Tried for hours to figure out the various relationship() options with no
luck
two through twelve actually shows 25 .. 40
--
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To unsubscribe from this group and stop receiving emails from it, send an email
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send
Hi there
Just wondering, before 0.7 is released and the API is baked, is it
necessary to have all event names start with on_? It seems
redundant and hackish. (Use a property?)
Also, retval seems a prominent api symbol, it seems a shame to have
such a strained abbreviation. returns ?
a.
--
python had a standard top-
level namespace!)
On Dec 31, 3:37 am, Michael Bayer mike...@zzzcomputing.com wrote:
On Dec 30, 2010, at 8:35 AM, avdd wrote:
Hi there
Just wondering, before 0.7 is released and the API is baked, is it
necessary to have all event names start with on_? It seems
On Dec 31, 3:37 am, Michael Bayer mike...@zzzcomputing.com wrote:
retval is not fantastic, though it is a known term used by pdb for
instance. returns as a boolean sounds like its suggesting the function
may or may not return. A non-abbrevated name would be has_return_value.
I'd say
Hi Joel,
Although my application is deployed on the web it was written with the
goal of being redeployable as a desktop app, and to this end I have
been able to abstract away the web details so that I can code my
application very similarly to a desktop app.
The relevance here is that all
I rely heavily on the version_id_col feature and I would like to be
able to either explicitly increment the version, or have the version
incremented when a relationship changes. The issue here is that a
change in a relationship is a semantic change to the parent record and
should conflict with
I'm glad you brought this up. It seems to me that the the declarative
instrumentation keys classes by their unqualified class name,
precluding using the same class name for different declarative
subclasses (ie, in different modules).
On Jul 9, 12:01 pm, Randy Syring ra...@rcs-comp.com wrote:
Is there a reason for preventing updates to the polymorphic_on column?
I tried removing that branch (mapper.py:1628) and the mapper tests all
pass. (although there are problems with other tests that are
unaffected by this change)
a.
--
You received this message because you are subscribed to
setstate(state)
File /home/avdd/work/careflight/src/intranet.ops/carenet/src/
sqlalchemy.6/lib/sqlalchemy/orm/collections.py, line 618, in
__setstate__
self.attr = getattr(d['owner_state'].obj().__class__,
d['key']).impl
AttributeError: type object 'NoneType' has no attribute 'children2'
--
You
In a metaclass's __init__, the attributes have already been placed on
the class, so mutating the attributes dict has no effect.
Try setting the id attribute directly:
self.id = PrimaryKey(...)
On Mar 27, 6:04 pm, Daniel Robbins drobb...@funtoo.org wrote:
Hi All,
In 0.6_beta2, the following
Hi anusha,
The error is unrelated to your Login query because sqlalchemy compiles
the mappers as late as possible. It might help if you put somewhere
in your application code, after you have imported all your entities,
the lines:
from sqlalchemy import orm
orm.compile_mappers()
to catch
mike...@zzzcomputing.com wrote:
On Feb 13, 2010, at 11:03 AM, avdd wrote:
I'm getting some strange errors with unpickling. I've tried all
combinations of pickle/cPickle and protocol in (0,1,2) and still
getting this apparent random error:
sqlalchemy.orm.collections:622 __setstate__
I'm getting some strange errors with unpickling. I've tried all
combinations of pickle/cPickle and protocol in (0,1,2) and still
getting this apparent random error:
sqlalchemy.orm.collections:622 __setstate__
self.attr = getattr(d['owner_state'].obj().__class__,
d['key']).impl
Bruce Momjiam takes a swipe at the python postgresql drivers:
http://archives.postgresql.org/pgsql-hackers/2010-02/msg00351.php
Confined as the above discussion is to the ghetto of a mailing list,
perhaps someone knowledgeable here can respond publicly?
a.
--
You received this message
So I get around this by essentially doing:
# called on every request
def refresh_model(context, obj):
context.get_db().add(obj)
def store_model(context, obj):
db = object_session(obj)
if db:
db.expunge(obj)
obj = db.merge(obj)
db.flush()
return obj
Which seems to
On Feb 2, 2:52 am, Michael Bayer mike...@zzzcomputing.com wrote:
the behavior you first illustrated, that of merge() and add() not acting
the same regarding pending changes, was a behavior that was somewhat in
the realm of a bug. I mentioned the other day it was fixed in r6711.
Well no,
I'm using session.add() to refresh my objects while working on them,
because I don't want to merge them with the persistent state. But it
appears deletes aren't carrying across to child relations:
$ cat listdelete.py; python listdelete.py
import sqlalchemy as sql
from sqlalchemy import orm
On Jan 31, 4:33 am, Michael Bayer mike...@zzzcomputing.com wrote:
this example is too compliated for me to understand without great effort,
perhaps someone else has the time to follow it more closely - it appears to
be creating and closing many new sessions and add()ing objects between them -
(A).first().uc[0]
with db.begin():
del db.query(A).first().oc[0]
Traceback (most recent call last):
File testordlist.py, line 40, in module
del db.query(A).first().oc[0]
File /home/avdd/tmp/src/sqlalchemy.5/lib/sqlalchemy/orm/
session.py, line 449, in __exit__
self.commit()
File /home
On Jan 29, 3:52 am, Michael Bayer mike...@zzzcomputing.com wrote:
you
need to delete the object individually and flush before altering the
collection.
Thanks for the advice, but I can't do that because I'm working with
objects (generically)
in the detached state and committing later. I'll
Here's my reworking of the example for time types:
from datetime import datetime, timedelta, date
from sqlalchemy import MetaData, Table, Column, DateTime, Date,
Interval
from sqlalchemy.orm import mapper, create_session
metadata = MetaData('postgresql:///avdd')
interval_table1 = Table
The descriptor works by returning an SQL Expression when called on a
class argument:
Interval.length - SQL Expression
Interval.contains(arg) - SQLExpression
and operates normally on instances, ie, just runs the function.
On Jan 15, 11:41 pm, bojanb boj...@gmail.com wrote:
Thanks Mike. I
sqlalchemy.orm import sessionmaker
from sqlalchemy import Column, Integer, create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.dialects.postgresql.base import ARRAY
engine = create_engine('postgresql:///avdd')
DB = sessionmaker(bind=engine)
class A(declarative_base
Thanks! Works great.
On Jan 14, 2:27 am, Michael Bayer mike...@zzzcomputing.com wrote:
avdd wrote:
I want to map a table with a postgresql array as a primary key.
PostgreSQL supports it, and everything works until the session wants
to use the list returned from the query as an instance
]
sqlalchemy.orm.mapper: _get_state_attr_by_column
return self._get_col_to_prop(column).getattr(state, column)
sqlalchemy.orm.properties:99 getattr
return state.get_impl(self.key).get(state, state.dict)
AttributeError: 'NoneType' object has no attribute 'get'
On Dec 17, 6:46 pm, avdd adr
You could inject the attributes in a metaclass:
def common_columns():
return dict(id = Column(Integer, primary_key=True),
foo = Column(String))
Base = None
class mymeta(DeclarativeMeta):
def __init__(self, name, bases, attrs):
if Base is not None:
#
/lib/python2.6/pickle.py, line 858, in load
dispatch[key](self)
File /usr/lib/python2.6/pickle.py, line 1217, in load_build
setstate(state)
File /home/avdd/tmp/src/sqlalchemy.5/lib/sqlalchemy/orm/
collections.py, line 612, in __setstate__
self.attr = getattr(d['owner_state'].obj
On Dec 18, 12:58 pm, avdd adr...@gmail.com wrote:
# testlazy.py
No, I'm wrong. Investigating further...
--
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from
Thanks, Mike. I was calling compile_mappers before importing the
modules. Whoops!
On Dec 18, 1:10 pm, avdd adr...@gmail.com wrote:
On Dec 18, 12:58 pm, avdd adr...@gmail.com wrote:
# testlazy.py
No, I'm wrong. Investigating further...
--
You received this message because you
I use pickle to serialise unsaved objects in a user session. Normally
this works fine, except that for development I use an auto-reloading
server, and pickling some objects is hitting a case where some lazy
attribute isn't fully compiled.
...
File '/home/avdd/work/careflight/src/intranet.ops2
Hi
I'm trying to merge objects across sessions and I'm seeing some odd
behavour with a one-one child relation:
import sqlalchemy as sql
import sqlalchemy.orm as orm
from sqlalchemy.ext.declarative import declarative_base
engine = sql.create_engine('sqlite:///:memory:')
metadata =
On Dec 14, 12:35 pm, Michael Bayer mike...@zzzcomputing.com wrote:
confirmed. this is fixed in r6553 trunk/0.6 / r6554 0.5 branch.
Thanks Mike, you're a legend!
--
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this group, send email
On Jul 27, 9:45 am, jason kirtland [EMAIL PROTECTED] wrote:
This is the last opportunity
for terminology changes for a while, so I offer this up for discussion.
Does anyone else think orm.relation is wrong? Perhaps
relationship if you must have a noun, or relates_to, etc, but
relation could
36 matches
Mail list logo