See
http://groups.google.com/group/sqlalchemy/browse_thread/thread/aa9c753384532e6c/8d070ff7208494b1
The solution though I believe is just:
from sqlalchemy import create_engine
from sqlalchemy.pool import NullPool
to_engine = create_engine('sqlite:///%s' % temp_file_name, poolclass=NullPool)
On Mon, 2010-08-16 at 13:01 -0700, Italo Maia wrote:
How's the best way to filter a date field by year?
Maybe something like:
from sqlalchemy import and_
import datetime
relevant_year = 1978
query = session.query(MyClass).filter(and_(
MyClass.my_date = datetime.date(relevant_year, 1,
On Wed, 2010-07-28 at 11:33 +, Faheem Mitha wrote:
On Wed, 28 Jul 2010 15:17:09 +0530 (IST), Faheem Mitha fah...@email.unc.edu
wrote:
Hi,
When calling create_all on a metadata instance after a session has
alrady been opened causes the create_all to hang, I assume because
the
On Wed, 2010-07-28 at 17:17 +, Faheem Mitha wrote:
Hi Lance,
On Wed, 28 Jul 2010 06:45:30 -0500, Lance Edgar lance.ed...@gmail.com wrote:
--=-dKyzuPx4woj1H0B5IT48
Content-Type: text/plain; charset=ISO-8859-1
On Wed, 2010-07-28 at 11:33 +, Faheem Mitha wrote:
On Wed, 28 Jul
On 7/26/2010 4:55 PM, Faheem Mitha wrote:
Hi,
It turns out my example was too hasty. I should have had something like
foobar = Table(
'foo', meta,
Column('id', Integer, nullable=False, primary_key=True),
)
bar = Table(
'bar', meta,
Column('id', None,
On 7/24/2010 8:21 AM, manman wrote:
table A,B
B.a_id=A.id
my code like this:
new_a=A()
session.begin()
session.add(new_a)
new_b=B()
new_b.a_id=new_a.id
session.add(new_b)
try:
session.commit()
except:
session.rollback()
raise
why new_b.a_id is None? how to do?
I presume a.id
On Sat, 2010-07-24 at 07:06 -0700, manman wrote:
thanks.
if not use relation then how to do? i hate use ForeignKey or
ManyToMany.
So did the explicit call to session.flush() not work? Here it is again
for reference:
new_a = A()
session.begin()
session.add(new_a)
session.flush()
On Sat, 2010-07-24 at 08:06 -0700, manman wrote:
new_a=A()
session.begin()
session.add(new_a)
session.flush()
new_b=B()
new_b.a_id=new_a.id
session.add(new_b)
try:
session.commit()
except:
session.rollback()
raise
this code is right? when error all be rollback?
Should
On 7/8/2010 3:23 AM, Chris Withers wrote:
Hi All,
I'm working on a variation of this recipe:
http://www.sqlalchemy.org/trac/wiki/UsageRecipes/VersionedRows
...and I've got a couple of questions about changed objects:
- do objects end up in session.dirty as a result of attributes being
set
On Wed, 2010-07-07 at 11:13 -0400, thatsanicehatyouh...@mac.com wrote:
Hi,
I have a question that I can't find a satisfactory answer to. Apologies in
advance if it's more of a Python question, but it's possible that there is a
SA solution.
I have a project that defines a database
On Jul 7, 8:56 am, Michael Bayer mike...@zzzcomputing.com wrote:
On Jul 7, 2010, at 1:30 AM, Lance Edgar wrote:
Hi, I was wondering what method might be used (assuming it's possible)
to redefine a column's attribute type after the mapping has already
been made? Specifically I have
On Jul 7, 2:01 pm, Michael Bayer mike...@zzzcomputing.com wrote:
On Jul 7, 2010, at 1:53 PM, Lance Edgar wrote:
OMichael, thanks for the tip. I still found this somewhat confusing
though:
When my code runs, the mapper has already been created (and
compiled, I assume). So what I
On Wed, 2010-07-07 at 18:45 -0400, Michael Bayer wrote:
On Jul 7, 2010, at 6:30 PM, Lance Edgar wrote:
On Jul 7, 2:01 pm, Michael Bayer mike...@zzzcomputing.com wrote:
On Jul 7, 2010, at 1:53 PM, Lance Edgar wrote:
OMichael, thanks for the tip. I still found this somewhat
Hi, I was wondering what method might be used (assuming it's possible)
to redefine a column's attribute type after the mapping has already
been made? Specifically I have the following scenario:
from sqlalchemy import *
from sqlalchemy.orm import mapper
metadata = MetaData()
orders = Table(
On 7/5/2010 10:55 PM, Andrew Bialecki wrote:
I've looked for a while, but I can't find the *best* way to use the
ORM to generate the following query:
SELECT user_id, count(*) cnt
FROM orders
GROUP BY user_id
I have classes that represent both User and Order. So what should go
after:
On 6/23/2010 5:28 AM, Alexander Zhabotinskiy wrote:
Hello. I'v got an problem
I have a string like 'john' and I need to get results for 'john, JOHN'
etc. How to do that?
I think perhaps the ilike() filter operator might be the only way? It
might even depend on your back-end.
On 6/10/2010 10:29 AM, Aref wrote:
Thank you for the response. However, that is not the problem. If I do
update = table.update(project.c.ProjectID=='project-name', values =
{project.c.ProjectID:'program'})
print update
update.execute()
everything works fine.
if I do this:
test =
On 6/10/2010 11:22 AM, Aref wrote:
Thank you very much. I'll try it. Is there a better way of doing this--
I mean there must be since this is necessary for any application
needing to modify a database where generally tables are accessed
dynamically.
Well, I suspect the "better way"
On 6/1/2010 7:18 AM, nospam wrote:
I see significant slow down if I have 1000 items, and a couple of
annotations for each one. That's a 1001 queries I need to make, so I
want to avoid the for loop there - and just have 1 query that returns
me the list of correct annotation objs.
I think this
On 5/30/2010 7:36 AM, nospam wrote:
Thanks Lance. Would this lazily load the annotations for each item?
I'm trying to avoid # of item trips to the db, and also avoid
loading all the annotations.for each item. I'm thinking I can do w/
some joins, and subquery()'s...
This would load the
On 5/30/2010 9:43 AM, Eric Lemoine wrote:
On Sun, May 30, 2010 at 4:39 PM, Eric Lemoine
eric.lemo...@camptocamp.com wrote:
Hello
I use Pylons. Pylons does:
Session = scoped_session(sessionmaker())
and then:
Session.configure(bind=engine)
My question: with a reference to Session how
On 5/30/2010 5:49 PM, Chris C wrote:
I'm hoping to write a Python package which integrates Sphinx Search
(open-source SQL full-text search) and SQLAlchemy. Unfortunately, I
don't have much insight into the internals of SQLAlchemy (though I've
been reviewing the documentation/source trying to
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,
On 4/27/2010 5:22 AM, jo wrote:
Hi all,
In version 0.6 seems the group_by property does nothing...
(Pdb) sql =
select([Verifica.c.codice,func.sum(Prestazione.c.importo).label('importo')])
(Pdb) print sql
SELECT verifica.codice, sum(prestazione.importo) AS importo
FROM verifica, prestazione
On 4/25/2010 6:39 AM, Adrian wrote:
class MenuNode(Base):
__tablename__ = 'menu'
id = Column(Integer, primary_key=True, nullable=False,
unique=True)
parent_id = Column(Integer, ForeignKey('menu.id',
onupdate='CASCADE', ondelete='CASCADE'), nullable=True, index=True)
name =
On 4/23/2010 9:19 AM, jose soares wrote:
jo wrote:
Hi all,
I need to insert a new row and get back the last inserted id,
I have some difficulty using the flush(), then I'm trying with
commit() but
I can't understand how commit() works in 0.6.
In the following script I try to update a row and
Sorry, I'd meant for that code to be self-contained but of course I forgot to
set up the engine. As an example you can try the following (see inserted code
below).
Lance
On 4/23/2010 9:50 AM, jose soares wrote:
session.commit() raises an UnBoundExecutionError:
Would this (not) work?
from
On 4/23/2010 9:33 AM, Alexander Zhabotinskiy wrote:
Hello.
How to filter by list
may be like:
.filter(Some.value==[1,2,3])
I believe you want the IN filter; see
http://www.sqlalchemy.org/docs/ormtutorial.html#common-filter-operators.
Lance
--
You received this message because you are
Hi, I'm writing a new custom dialect for a legacy database (Centura
SQLBase 7.5.1) for use in migrating to a new system over time.
Everything's gone pretty well, until I needed a join...
Whereas most dialects would create a statement such as:
SELECT T1.ID, T1.COL1, T2.COL2
FROM T1 JOIN T2
ON
29 matches
Mail list logo