I see.
Thanks a lot for the quick response!
I'll be looking forward to 1.2.3.
Le jeudi 15 février 2018 18:01:38 UTC-5, Mike Bayer a écrit :
>
> On Thu, Feb 15, 2018 at 4:48 PM, Charles Langlois > wrote:
> > I believe my problem is related to
> >
On Thu, Feb 15, 2018 at 4:48 PM, Charles Langlois wrote:
> I believe my problem is related to
> https://bitbucket.org/zzzeek/sqlalchemy/issues/4124.
>
> I have an AbstractConcreteBase inheritance hierarchy that looks like this:
>
> class AbstractBase(AbstractConcreteBase,
I believe my problem is related to
https://bitbucket.org/zzzeek/sqlalchemy/issues/4124.
I have an AbstractConcreteBase inheritance hierarchy that looks like this:
class AbstractBase(AbstractConcreteBase, Base):
@declared_attr
def column1(cls):
return Column(...)
You need just that:
from proj.core import Session
@app.teardown_request
def clear_session():
Session.remove()
Session created with scoper_session, of course. We do not use
flask-sqlalchemy package, just flask and separated sqlalchemy.
чт, 15 февр. 2018 г., 16:28 Simon King
When you say your first execute function doesn't work, what do you
mean? Do you get an error? Do the results not show up in the database?
I don't think there's any need for session.begin()
http://docs.sqlalchemy.org/en/latest/orm/session_api.html#sqlalchemy.orm.session.Session.begin
Simon
On
Hello, Simon!
Where did you read that I was using Flask?
I just write about it like example few posts ago.
Anyway.
I try another variant without decorator - just execute function
def execute(statement, **kwargs):
session = SESSION()
session.begin(subtransactions=True)
kwargs['tries'] =
Personally I wouldn't use decorators for this. I would make every
function that needs to interact with the database take an explicit
session parameter, and I would use the facilities of the web framework
to create the session at the beginning of the request and close it at
the end. I've never used
Hello, Simon!
So what better way?
Something like this?
SESSION = sessionmaker(bind=engine, autocommit=True)
@decorator_with_args
def session_decorator(func, default=None):
def wrapper(*a, **kw):
session = SESSION()
session.begin(subtransactions=True)
if 'session' not
On Thu, Feb 15, 2018 at 5:09 AM, George wrote:
> I have searched the documentation but didn't find anything useful. Please
> guide me in the right direction.
>
I'm not sure I understand the question. Relationships are part of the
ORM layer of SQLAlchemy, not Core. Can you