On 30 Sep 2014, at 23:18, tonthon tontho...@gmail.com wrote:
I didn't knew merge was supposes to be used in such a case, it works like a
charm.
Following that tip, I've added this decorator :
def cache_wrapper(func):
ensure a model returned from a cached function
On 13 Sep 2014, at 11:25, pyArchInit ArcheoImagineers pyarchi...@gmail.com
wrote:
Il giorno giovedì 11 settembre 2014 18:39:24 UTC+2, Jonathan Vanasco ha
scritto:
i once thought about extending SqlAlchemy to handle this issue behind the
scenes, but each database treats `IN()`
On 20 Aug 2014, at 20:02, Rafael Henrique da Silva Correia
rafaelhenr...@gmail.com wrote:
Hi !
I have a block of code similar to this I made to test:
def TEST():
teste = Test(descricao=str('wololo'))
try:
db.session.add(wololo)
db.session.commit()
On 17 Apr 2014, at 04:43, Chip Kellam blackroomd...@gmail.com wrote:
I have an application in which I primarily rely on MySQL/InnoDB and using the
SQLAlchemy ORM and leveraging the transaction python module. Everything is
good.
My problem is that, try as I might, using code similar to
On 15 Apr 2014, at 01:12, Jonathan Vanasco jonat...@findmeon.com wrote:
i've got that now as a stopgap; i was hoping someone has better ideas. i
don't like the idea of a post-commit hook, because i fear requesting the
celery task request will create an error. I really don't want to build
On 15 Apr 2014, at 13:25, Richard Gerd Kuesters rich...@humantech.com.br
wrote:
interesting, i didn't knew that :D
i was using shomething like (for softwares such as st2, which has pep8
checking):
## variables
NULL = None # f**k pep-8
TRUE = True # f**k pep-8
FALSE = False #
On 15 Apr 2014, at 13:06, robert rob...@redcor.ch wrote:
Hi there,
I m using SQLAlchemy V. 8.6 together with geomalcheny 2.4a second I get a call
I have a a mapped class:
# tblKey2goGdataLocation
#
#
On 08 Jan 2014, at 01:26, limodou limo...@gmail.com wrote:
But I don't know why make this decision. Because where NULL will get
nothing. And in 0.8.X version, I need to combine multiple condition according
user input to one condition, so my code just like:
cond = None
for c in
On 25 Dec 2013, at 00:27, David Bolen db3l@gmail.com wrote:
Sibylle Koczian nulla.epist...@web.de writes:
Exactly, that's it. The stackoverflow discussion was very instructive,
thank you! I'll try out psycopg2-dateutils.
I'm a big fan of dateutil. If you do use it, you may also
On 24 Dec 2013, at 08:11, Laurence Rowe laurencer...@gmail.com wrote:
Postgres' INTERVAL supports deltas of quantities other than days, +1 month
may mean 28/29/30/31 days depending on the month. From
On Oct 2, 2013, at 3:53 AM, Jonathan Vanasco jonat...@findmeon.com wrote:
do you recall if `flush()` initiated 'mark_changed' at some point in history?
i thought it did.
I'm pretty sure it never did that.
Wichert.
--
You received this message because you are subscribed to the Google
This message did not make it to the list last time, lets see if it work now..
On Sep 29, 2013, at 2:41 PM, Roman Iten roman.i...@sg-unteraegeri.ch wrote:
Hi
I started a pyramid project using the alchemy scaffold (includes
ZopeTransactionExtension to scope sessions to requests, see [1]).
On Jul 13, 2013, at 22:59, Michael Bayer mike...@zzzcomputing.com wrote:
The original intent of default for Column is that it acts exactly like
server_default, except it runs on the Python side for the case that your
schema wasn't created with this default, or the functionality of your
On Jun 17, 2013, at 08:58 , Chris Withers ch...@simplistix.co.uk wrote:
Hi All,
I seems to commonly need to do a query which should return zero or one mapped
objects.
.one() isn't what I want as no returned object is ok.
.first() isn't what I want as if my query would return more
On May 23, 2013, at 07:16 , Shyam Purkayastha shyam.g...@gmail.com wrote:
I am trying to play with the sql alchemy ORM based db definition with an
inmemory sqlite db.
SQLite does not enforce foreign key constraints unless you manually tell it to.
You can do that with a PRAGMA
On May 16, 2013, at 03:09 , Ji Zhang zhangj...@gmail.com wrote:
Hi,
Say I have a Request model and User model:
class Request(Base):
id = Column(Integer, primary_key=True)
user_id = Column(Integer)
admin_id = Column(Integer)
class User(Base):
id = Column(Integer,
I was looking at using a UUID as primary key for a table. Using the
backend-agnostic GUID type from
http://docs.sqlalchemy.org/en/rel_0_8/core/types.html#backend-agnostic-guid-type
I get strange behaviour though. I whipped up a simple test case:
class Data(BaseObject):
__tablename__ =
For reference I have attached a complete test case including a copy of the GUID
code from the documentation.
On May 6, 2013, at 23:22, Wichert Akkerman wich...@wiggy.net wrote:
I was looking at using a UUID as primary key for a table. Using the
backend-agnostic GUID type from
http
On Apr 19, 2013, at 08:54 , Andreas Jung j...@lpcnv.com wrote:
Problem seems to be related how I moved the database (pg_dump + pg_restore).
After moving the database files directory I can no longer reproduce this
error.
I would guess you loaded your database dump into a database with a
On Feb 6, 2013, at 03:05 , Jonathan Vanasco jonat...@findmeon.com wrote:
I use SqlAlchemy in a Pyramid app. All my models, connections, etc
are within and set up by Pyramid.
I'm trying to do a maintenance script, and am a bit confused.
In my script, thanks to a bootstraped commandline
On Jan 30, 2013, at 17:53 , Michael Bayer mike...@zzzcomputing.com wrote:
I've asked people before about this seemingly ridiculous generate twice
requirement of LaTeX and I get these incredulous answers like why? what's
wrong with running it twice?, as though I'm being unreasonable.
It is
On Jan 22, 2013, at 08:26 , Alexey Vihorev viho...@gmail.com wrote:
Hi. Couple of questions...
1. Does SQLA support deep filtering, i.e. something like this:
query(Invoice).filter(Invoice.Customer.Country.name=='France')
You'll need to use a join to do this:
On Dec 14, 2012, at 22:11, Michael Bayer mike...@zzzcomputing.com wrote:
But the effect of only publishing 0.8.0b1 on Sourceforge was that I didn't
get the impression that we had so many people going out and testing the beta
as we normally do. I was reminded by Chris McDonough that a
,
cascade='all,delete,delete-orphan')
there's a patch for 0.8 only in http://www.sqlalchemy.org/trac/ticket/2517 .
On Jun 20, 2012, at 1:13 PM, Wichert Akkerman wrote:
I am struggling a little bit with mixin classes. The pattern I am trying to
implement is a mixin-class that adds a list
I am struggling a little bit with mixin classes. The pattern I am trying
to implement is a mixin-class that adds a list of validated search
queries to a model. A minimised version of the code is below. The
problem I am running into is that putting an association_proxy on a
mixin class does not
On 04/25/2012 03:57 PM, Massi wrote:
Hi everyone,
in my script I have to deal with a huge database with thousands of
tables. Given a table name (a python string) I would have to now if
such a table exists or not. Up to now I have written this function:
def DBGetTableByName(table_name) :
On 04/19/2012 07:43 PM, Michael Bayer wrote:
If you've seen my recent talks you saw that I'm a little skeptical of
what you're terming non-monolithic databases.Let's say this
means, a database with a set of tables maintained by entirely
different packages, but with the possibility of
retools
(http://readthedocs.org/docs/retools/en/latest/), other than that
dogpile does not support redis and retools only supports redis?
Wichert.
--
Wichert Akkerman wich...@wiggy.net It is simple to make things.
http://www.wiggy.net/ It is hard to make things simple.
--
You
On 2012-4-9 18:28, Michael Bayer wrote:
On Apr 9, 2012, at 11:49 AM, Wichert Akkerman wrote:
On 2012-4-9 17:28, Michael Bayer wrote:
There's a decent README up now at http://pypi.python.org/pypi/dogpile.cache and
you can read all the docs at http://dogpilecache.readthedocs.org/. I'm
I have been looking at making an ordered many-to-many list. The example
from Jason Kirkland from 2008
(http://groups.google.com/group/sqlalchemy/browse_thread/thread/611c88ee27354246
) worked, but our version of it did not. I have modified his version
(see code at the end of the mail) to use
. If your backend support it you might be able to get away with
using savepoints (see
http://www.sqlalchemy.org/docs/orm/session.html#using-savepoint ).
Wichert.
--
Wichert Akkerman wich...@wiggy.net It is simple to make things.
http://www.wiggy.net/ It is hard to make things
http://www.sqlalchemy.org/docs/core/engines.html#database-urls for
documentation on database URLs.
Wichert.
--
Wichert Akkerman wich...@wiggy.net It is simple to make things.
http://www.wiggy.net/ It is hard to make things simple.
--
You received this message because you
On 12/30/2011 02:36 AM, Michael Bayer wrote:
Hi all -
Just in the interests of keeping fresh, I've upgraded Trac from 0.11 to 0.12,
as part of a migration of all of sqlalchemy.org to a new host. Assuming your
dns has switched, you'll be browsing around the updated interface which has
some
On 11/17/2011 01:42 PM, raulna wrote:
Hi,
i need save results in a python object from multiples querys, like:
for user in users:
phones = DBSession.query(Phone).filter('...
python_object = python_object + phones ?
How can i append this results in
On 11/13/2011 06:51 PM, Vlad K. wrote:
Yes, again thanks for joining the topic there. Savepoints are doable
by zope.transaction I am just not sure to what extent. I can't seem to
find any docs and I have to walk through the code and not all features
are commented or docstring'd.
They should
On 11/11/2011 11:20 AM, Alex K wrote:
Thanks, but if I need allow nullable primary_keys it not works.
I tried:
user_id = db.Column(db.Integer, db.ForeignKey('user.id
http://user.id', ondelete='SET NULL'), primary_key=True,
nullable=True, server_default=text('NULL'))
A primary key can never
I am fighting a bit of an odd issue (using SQLAlchemy 0.7.3). I have an
account class, where each account has a list of strings managed via an
association proxy. For a reason I can't seem to find the values are not
persisted. The test case below demonstrates this: SQLAlchemy prints a
Object of
I hate to do this kind of thing, but I haven't gotten any feedback on
this and I would love to hear some feedback/opinions. How do other
people handle deferrable constraints?
On 2011-9-14 13:59, Wichert Akkerman wrote:
On 09/14/2011 12:25 PM, Wichert Akkerman wrote:
Constraints marked
use the power of python:
Session.query(Files.original_name,
*[c.name for c in MSPResponse.__table__.c])
Wichert.
--
Wichert Akkerman wich...@wiggy.net It is simple to make things.
http://www.wiggy.net/ It is hard to make things simple.
--
You received this message
I am correct in assuming that update() does not work on polymorphic
classes? I'm getting a ArgumentError: Only update via a single table
query is currently supported error which seems to suggest that is the case.
Wichert.
--
You received this message because you are subscribed to the Google
On 09/15/2011 04:13 PM, Michael Bayer wrote:
that is the case you'd need to emit UPDATE against each table
individually
I tried that quickly but still got the same error. My model looks like
this (the full thing is at
Constraints marked as deferrable result in a syntax error when using
SQLite. Is this deliberate, or a bug in the sqlite dialect?
Regards,
Wichert.
--
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this group, send email to
On 09/14/2011 12:25 PM, Wichert Akkerman wrote:
Constraints marked as deferrable result in a syntax error when using
SQLite. Is this deliberate, or a bug in the sqlite dialect?
As a workaround I figured I could use events to only add deferrable
constraint variants on PostgreSQL and use
On 09/02/2011 03:31 AM, Michael Bayer wrote:
With SQLAlchemy you should have an ongoing transaction/session defined
externally to individual operations on your mapped objects - SQLA uses
the unit of work pattern which specifically is about grouping
related persistence/query operations
On 08/15/2011 10:20 AM, Eduardo wrote:
Here is the example:
column_names = session.query(tab.c.name).filter(tab.c.value==354)
column_names = [column_name for (column_name,) in column_names]
On 08/12/2011 05:52 PM, NiL wrote:
say you want to filter on the 'field' (field would be a string
representing the name of the field) on objects of class == Klass
field_attr = getattr(Klass, field)
would give you the instrumented attribute
then
Session.query(Klass).filter(field_attr ==
I have a model where I have articles and images, with a many-to-many
relation between them. Since the order of images for an article is
important this relation should be ordered from the article site. My
naieve implementation looks like this:
article_images = Table('article_image',
On 08/09/2011 02:38 PM, Wichert Akkerman wrote:
I have a model where I have articles and images, with a many-to-many
relation between them. Since the order of images for an article is
important this relation should be ordered from the article site. My
naieve implementation looks like
On 08/05/2011 10:46 PM, Mark Erbaugh wrote:
This is more of a Python issue than a SA issue, but I had trouble getting this to
work. I did, but the code seems a little awkard to mesigh. In addition to
the requirements already, I also wanted toe default value to be a class level
'constant'.
On 2011-7-17 11:07, Chris Withers wrote:
On 30/06/2011 09:30, Wichert Akkerman wrote:
On 06/30/2011 10:14 AM, Chris Withers wrote:
- Specify sqlalchemy 0.6 as a requirement, until
zope.sqlalchemy is ported, mortar_rdb shouldn't be
used with :mod:`sqlalchemy` 0.7.
What is missing
On 06/30/2011 10:14 AM, Chris Withers wrote:
- Specify sqlalchemy 0.6 as a requirement, until
zope.sqlalchemy is ported, mortar_rdb shouldn't be
used with :mod:`sqlalchemy` 0.7.
What is missing? zope.sqlalchemy seems to work fine with sqlalchemy 0.7
as far as I've seen.
WIchert.
--
You
On 3/23/11 23:11 , Hector Blanco wrote:
Yeah... the closing thing is because this is going to be in a
webserver, and the framework that controls the requests really, really
messed up everything (mysql daemon, sqlalchemy...) if the http request
was canceled (If I had a user pressing F5 in Firefox
On 2/16/11 09:20 , Chris Withers wrote:
On 15/02/2011 14:27, Eric Lemoine wrote:
But aren't apps supposed to use=0.6.99 to avoid backward compats
issues?
Well, I wish I could just say 0.7 but I guess that would suck in 0.7
betas? Tarek?
0.7dev is the right restriction to use.
Wichert.
Hi Mike,
I grabbed SQLAlchemy from pypi when it was still there so I could do a
quick test with my current projects (yay for buildout with version
pinning). I'm happy to be able to report that the upgrade was seemless,
and all my tests were passing with 0.7b1.
Wichert.
On 2/13/11 01:51 ,
On 2/14/11 10:57 , M3nt0r3 wrote:
Yesterday my life become an hell. :)
On saturday ( :O ) SA0.7.b1 is released and easy_install start to use
it. The problem is that it broke some installer and doesn't work with
my app.
That sounds like a bug in your installer, not in SQLAlchemy.
Wichert.
--
On 2/14/11 11:25 , M3nt0r3 wrote:
My installer for windows download during the process some libs. I use
easy_install sqlalchemy and it works. Now too works but 0.7.b1 is not
working with the app itself now so it create a lot of problem. I thought
that if 0.7.b1 is a beta and brokes API maybe it
On 2/14/11 11:39 , Tarek Ziadé wrote:
On Mon, Feb 14, 2011 at 11:31 AM, Wichert Akkermanwich...@wiggy.net wrote:
It sounds like the dependencies in your package are too liberal. I would
change your dependency to SQLAlchemy=0.6,0.7dev. That way you can
never accidentally install an incompatible
Hi Mike,
On 1/9/11 00:14 , Michael Bayer wrote:
The majority of my time is now spent developing 0.7, which is nearly ready for
beta releases pending a few more little features I'd like to try to get in.
0.7 is really exciting with its new event API, lots of other nice touches and
of course
On 12/28/10 20:54 , Michael Bayer wrote:
On Dec 28, 2010, at 2:22 AM, Wichert Akkerman wrote:
On 2010-12-28 08:18, Hong Minhee wrote:
I don’t know why setuptools provides pkg_resources, implements another
incompatible way to declare namespace packages, additionally in spite of
existence
On 12/29/10 16:45 , Michael Bayer wrote:
Yeah this is what I'm seeing, that top level packagenames are used. I.e.
I would just say, Use sqlalchemycontrib as your package name, that's
what everyone should use. It would appear this approach means nothing
needs to happen at all witihin sqlalchemy
ImportError:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
I would suggest that SQLAlchemy does the same thing.
Wichert.
--
Wichert Akkerman wich...@wiggy.net It is simple to make things.
http://www.wiggy.net/ It is hard to make things
On an environment using SQLAlchemy 0.6.5 and psycopg 2.2.2 I run the
following code:
session.execute(Article.__table__.update()
.where(Article.retailer_id==self.retailer_id)
.where(Article.publish_end=datetime.date.today())
On 9/30/10 16:26 , dobrysmak wrote:
Hi guys.
I keep getting this message:
[paste.httpserver.ThreadPool] kill_hung_threads status: 10 threads (1
working, 9 idle, 0 starting) ave time 0.03sec, max time 0.03sec,
killed 0 workers
that's just the paste httpserver checking if any of your
On 8/3/10 16:50 , Benjamin Peterson wrote:
Is there a way to force the ORM to insert a new row instead of updating?
Something like the must_insert argument to model's save method in Django's ORM.
The use case is I must create a unique session key (for a cookie) and want an
error when the key
On 7/29/10 17:18 , Faheem Mitha wrote:
Hi Simon,
Thanks. Do you understand why this blocking takes place? I assume by
default create_all tries to make a different connection, and fails for
some reason?
My guess is that it does not fail, but your database is blocking the
create_all statements
of generating the statement as well.
Wichert.
--
Wichert Akkerman wich...@wiggy.net It is simple to make things.
http://www.wiggy.net/ It is hard to make things simple.
--
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post
On 2/14/10 19:02 , Antoine Pitrou wrote:
Le dimanche 14 février 2010 à 17:47 +, Chris Withers a écrit :
Wichert Akkerman wrote:
On 2010-2-9 09:48, Chris Withers wrote:
I know that zope's transaction package aims to do just this, I wonder if
anyone's used that, or anything else, with SA
On 2/14/10 19:54 , Antoine Pitrou wrote:
Le dimanche 14 février 2010 à 19:45 +0100, Wichert Akkerman a écrit :
That is by design: zope.sqlalchemy (which is really the thing you are
complaining about) forces you to commit the entire transaction. This is
required to coordinate transactions
not do the substitutions, the DB-API driver does that.
So you'll need to look at your database driver to see if that supports
logging of commands. You can make postgres log all its commands, perhaps
that is an option for you.
Wichert.
--
Wichert Akkerman wich...@wiggy.net It is simple
storage systems. Most commonly
using repoze.tm2 to integrate with a WSGI stack, zope.sqlalchemy to
integrate SQLAlchemy with transaction and repoze.filesafe to do
transaction-safe file creation.
Wichert.
--
Wichert Akkerman wich...@wiggy.net It is simple to make things.
http://www.wiggy.net
Postgres can handle timezones fairly well. Using a direct select you can
see how it handles daylight saving correctly:
test=# select
'2010-01-15 12:30 Europe/Amsterdam'::timestamp with time zone,
'2010-01-15 12:30 Europe/Amsterdam'::timestamp with time zone +
interval '7
) that
are effectively records for groups of simple data types like strings,
dates, numbers, etc.
lxml with its objectify mode?
Wichert.
--
Wichert Akkerman wich...@wiggy.net It is simple to make things.
http://www.wiggy.net/ It is hard to make things simple.
--
You received
doing something wrong here,
or could this be a SQLALchemy bug? If so I can try to boil this down to
a failing testcase.
Wichert.
--
Wichert Akkerman wich...@wiggy.net It is simple to make things.
http://www.wiggy.net/ It is hard to make things simple.
--
You received
On 2009-11-25 16:15, Michael Bayer wrote:
Wichert Akkerman wrote:
I have a data model which has accounts and events, and a many-to-many
relation between the two using a CalendarEvent class. It boils down to
this:
class Account(BaseObject):
__tablename__ = account
id
On 11/2/09 14:04 , Sir Rawlins wrote:
Hello Guys,
I'm getting an exception thrown when trying to save an entity into a
SQLite database, this is a database/app which has been ported over
from a MySQL backend.
The exception looks like this:
InterfaceError: (InterfaceError) Error binding
On 8/6/09 09:30 , werner wrote:
IIRC correctly the __init__ section is only needed if you want to do:
add = Address('an email address')
I never do this, i.e. I assign like this
add = Address()
add.email_address = 'an email address'
You can also do this with the default declarative base
. Does this look like a
bug, or am I missing something?
Wichert.
--
Wichert Akkerman wich...@wiggy.net It is simple to make things.
http://www.wiggy.net/ It is hard to make things simple.
--~--~-~--~~~---~--~~
You received this message because you
more complex and expensive.
I am hoping someone here has encountered this pattern before and came up
with a good solution.
Wichert.
--
Wichert Akkerman wich...@wiggy.netIt is simple to make things.
http://www.wiggy.net/ It is hard to make things simple
are?
Wichert.
--
Wichert Akkerman wich...@wiggy.netIt is simple to make things.
http://www.wiggy.net/ It is hard to make things simple.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
sqlalchemy group
Previously Michael Bayer wrote:
On May 18, 2009, at 7:01 AM, Wichert Akkerman wrote:
session = orm.relation(SurveySession, cascade=all,
remote_side=[SurveySession.id],
primaryjoin=SurveySession.id==TreeNode.session_id)
parent = orm.relation(TreeNode
side argument
set([sqlalchemy.sql.expression.ColumnClause at 0x1120bd0; TreeNode.id])
I can't seem to figure out what the correct spelling is.
Wichert.
--
Wichert Akkerman wich...@wiggy.netIt is simple to make things.
http://www.wiggy.net/ It is hard to make things simple
argument 'currency'
I find it hard to believe parameter binding does not work, since SA uses
that internally, but I also can't spot my mistake unfortunately.
Wichert.
--
Wichert Akkerman wich...@wiggy.netIt is simple to make things.
http://www.wiggy.net/ It is hard to make
configuration settings which you can use to
make it log all queries to its logfile. Perhaps that would be useful for
you?
Wichert.
--
Wichert Akkerman wich...@wiggy.netIt is simple to make things.
http://www.wiggy.net/ It is hard to make things simple
Previously Michael Bayer wrote:
On Feb 26, 2009, at 8:21 AM, Wichert Akkerman wrote:
What happens if you do not call expunge on it, but pickle the object
in a
cache, load it later and then merge it?
the state of the newly unpickled object, that is the current value of
its mapped
On 12/25/08 4:37 PM, Michael Bayer wrote:
On Dec 25, 2008, at 6:45 AM, Wichert Akkerman wrote:
I have a reasonably standard hierarchical datastructure which I'm
trying
to store in SQL. The basic model looks like this:
class Page(BaseObject):
__tablename__ = page
id
. Is
it possible to build that parent list like that?
Wichert.
--
Wichert Akkerman wich...@wiggy.netIt is simple to make things.
http://www.wiggy.net/ It is hard to make things simple.
--~--~-~--~~~---~--~~
You received this message because you
86 matches
Mail list logo