I don't know of a way to do what you're asking. However, you could simply
create your own constructor for MyDBLog which truncates the string if it is too
long.
Barry
- Original Message
From: Eoghan Murray [EMAIL PROTECTED]
To: sqlalchemy sqlalchemy@googlegroups.com
Sent: Thursday,
I use Gnosis Utils for a similar purpose. The API is similar to pickle, but if
you need to control the details of the serialization (which fields get
serialized and how), then that is quite different. Gnosis has a concept called
mutators for this.
Barry
- Original Message
From:
The identity and visit stuff is pluggable, i.e. you can replace the existing
components without hackery; just write your own and specify which one to use in
the application .cfg file. This probably sounds more intimidating than it is;
the code is really pretty straightforward and you can use
By chance, in your mappers, are you declaring two relationships instead of one
relation with a backref?
As a side note, once you straighten this out, you may want to declare the
composite (a_id, b_id) as a unique key on the relation table.
Barry
- Original Message
From: Karlo
(a)
and I have been wondering if there is a way to just do:
b.as.append(a)
and have SA automatically check if it was already in collection and
shouldn't be added again.
On Sun, May 4, 2008 at 4:40 PM, Barry Hart [EMAIL PROTECTED] wrote:
By chance, in your mappers, are you declaring two relationships
My fault - when I said there was an error check, it was for the case where you
declare relationships A-B and B-A both with backrefs. Here's the thread from
about six months ago:
http://groups.google.com/group/sqlalchemy/browse_thread/thread/420b7de79119ad4d/8e8311bfd18d05e2?lnk=gstq=barry+hart
SA to be (i.e. would View act read-only, etc.. though I guess VIEWs
aren't necessarily purely read-only in some cases ?).
Right. For example, I think SQL Server views are updateable to some extent
(depending on whether there's a table primary key in the column list, whether
there are joins,
Is this what you want?
select([my_table.c.my_column], distinct=True)
Barry
- Original Message
From: JamesT [EMAIL PROTECTED]
To: sqlalchemy sqlalchemy@googlegroups.com
Sent: Wednesday, November 7, 2007 2:05:13 AM
Subject: [sqlalchemy] Select entire column
I am looking to filter
I would've declared the relation from Country to CountryLanguage, not vice
versa, but I doubt that is the reason for your error.
Can you provide a full example which reproduces the error?
Barry
- Original Message
From: mmstud [EMAIL PROTECTED]
To: sqlalchemy
You need to add an ID column to your countries_languages table, like this:
Column(id, Integer, primary_key=True),
Alternatively you could declare the combination country_id and language_id as
your primary key.
Barry
- Original Message
From: mmstud [EMAIL PROTECTED]
To: sqlalchemy
No, the association proxy would be used if you want to let users directly
access movies or vice versa. To get the score, you can define a mapper for
movie_vote table and define relationships between it and users and movies.
Barry
- Original Message
From: Jason [EMAIL PROTECTED]
To:
= sess.query(A).get(a1.id)
assert len(a1.bs) == 2
for m2m in (True, False):
for cascade in (True, False):
for useclear in (True, False):
test(m2m, cascade, useclear)
On Oct 24, 2007, at 4:18 PM, Barry Hart wrote:
I found a problem in SqlAlchemy 0.3.10
a relation list
On Oct 25, 2007, at 3:58 PM, Barry Hart wrote:
Here is a test case for the bug. The bug only manifests itself if
the transaction that slices the list also modifies all the
remaining objects in the list.
hi barry -
nice job again. we've narrowed down the specific
This subject came up on the TurboGears list and someone suggested I post here.
I noticed a while back that in SqlAlchemy 0.3.x, if you have two mapped classes
A and B, and you define the same relationship (with a backref) on both classes,
you won't get an error message but the two relationships
I found a problem in SqlAlchemy 0.3.10 this week: slicing a list
property caused the whole association list to be deleted. For example,
suppose I want to remove the first 3 items from a list of related items:
my_obj.related = my_obj.related[3:]
When these changes were saved , my_obj.related
- Original Message
From: Michael Bayer [EMAIL PROTECTED]
To: sqlalchemy@googlegroups.com
Sent: Wednesday, October 24, 2007 4:41:46 PM
Subject: [sqlalchemy] Re: Declaring a relationship twice - could SqlAlchemy
auto-detect problems like this?
On Oct 24, 2007, at 4:16 PM, Barry Hart wrote
:39 PM
Subject: [sqlalchemy] Re: Declaring a relationship twice - could SqlAlchemy
auto-detect problems like this?
On Oct 24, 2007, at 5:02 PM, Barry Hart wrote:
Here's what I had in mind. This set of mappings compiles without errors in
0.3.11:
from sqlalchemy import *
OK, thanks very
I've written code similar to this with no problems.
Are you using assign_mapper? If so, the save() call is unnecessary.
Do you get this error on the first object or on some subsequent object?
Barry
- Original Message
From: Lukasz Szybalski [EMAIL PROTECTED]
To:
Try this for the outer query:
s =
select([repetition_table.c.grade],(repetition_table.c.rep_number==2)
(repetition_table.c.card_key.in_(s_inner)) )
Barry
- Original Message
From: pbienst [EMAIL PROTECTED]
To: sqlalchemy sqlalchemy@googlegroups.com
Sent: Saturday, October 20, 2007
I think you want the final SQL query to look something like this:
select * from
card_table
join repetition_table on repetition_table.card_key = card_table.id
where repetition_table.rep_number = 1 and repetition_table.rep_number = 4 and
card_table.id in
(select ct2.id from card_table AS ct2
why would you be calling add_column() in this case (besides the PG bug
workaround) ?
We might call it for certain cases when we're building a report/data screen.
But 95% of the time we just want normal objects.
slice calls instances() yes.
Thanks, I'll keep instances() in mind as a possible
objects.
Barry
- Original Message
From: Barry Hart [EMAIL PROTECTED]
To: sqlalchemy@googlegroups.com
Sent: Thursday, September 6, 2007 1:55:14 PM
Subject: Re: [sqlalchemy] Re: Error combining DISTINCT and ORDER BY in an ORM
query on PostgreSQL
add_column() worked great, thanks!
Barry
I have an insert query in SQL where the records to be inserted are computed
from a SELECT. Can I build this query in the SqlAlchemy query construction
language?
INSERT INTO product_current_promotion (promotion_id, product_id)
SELECT promo_promotion.id, promo_promotion_items.product_id
FROM
SQLite supports an ATTACH command where multiple databases may be accessed
seamlessly using a single connection. Does PostgreSQL have something similar?
If so, then perhaps all you'd need is to add a few extra steps when you connect
to the database.
Barry
- Original Message
From:
Note that not all object 'fields' are present in the dictionary. For example,
in our app we may have a SQLAlchemy property '_foo' which is exposed as a
Python property 'foo'. In this case I believe '_foo' will be in the dictionary,
but your app should probably be working with 'foo'.
Barry
In our application's Order table, we have foreign-key fields which reference
the persons who placed the order, are responsible for fulfilling the order,
etc. For reporting speed, the Order table holds denormalized copies of contact
information for these people. Whenever one of the foreign keys
26 matches
Mail list logo