Hi,
I am using sqlalchemy with pylons and I am trying to extract some
metadata about the set of relationships between the objects I have
defined.
Specifically, I am trying to work out how to tell what kind of objects
are held in a one to many relationship.
e.g.
Two classes - person and phone num
I actually tried to use query.instances, but it behaved quite oddly. I
didn't debug or even echo the SQL calls yet, but it made accessing
those instances very slow. The actual instances call was quick, but
when accessing the objects from the resulting list it slowed down to
crawl.
I will recreate
I think SessionContext makes senses especially for architecture involving
multiple layers like mine where manager <-> DAO interaction happens.
Thx Michael.
On 4/12/07, Michael Bayer <[EMAIL PROTECTED]> wrote:
>
>
>
> On Apr 11, 2007, at 11:15 PM, Arun Kumar PG wrote:
>
> > Hi Michael,
> >
> > So
On Apr 13, 2:47 am, Jorge Godoy <[EMAIL PROTECTED]> wrote:
> IF you insist on doing that at your code, make the column UNIQUE (or a
> PK...) and write something like this pseudocode:
>
> def save_data():
> def insert_data():
>try:
>unique_column_value = get_
"Koen Bok" <[EMAIL PROTECTED]> writes:
> I need to have a uninterrupted number sequence in my table for
> invoices. I was trying to do it like this, but I can't get it to work.
> Can anyone give me a hint?
Let your database do the job. It is always aware of all connections
made to it, their con
I need to have a uninterrupted number sequence in my table for
invoices. I was trying to do it like this, but I can't get it to work.
Can anyone give me a hint?
request_table = Table('request', metadata,
Column('id', Integer, primary_key=True),
Column('number', Integer, unique=Tru
an engine uses a connection pool in all cases for all connections.
On Apr 12, 2007, at 4:29 PM, vinjvinj wrote:
>
>> conn = mysql.db.connect()
>>
>>
>>
>> conn.close()
>
>
> Thanks. That fixed the problem. Is sqlalchemy using a connection pool
> when I do this or is a new connection o
there you go.
On Apr 12, 2007, at 4:31 PM, ml wrote:
>
> I'm such a moron. I downloaded the SA source into a "sqlalchemy3"
> directory but the SA expects it in a "sqlalchemy" package so it was
> internaly loading the old 0.2.8 Ubuntu version.
>
> Sorry! :-)
>
>
> Michael Bayer napsal(a):
>>
>>
it runs for me with 0.3.6 and the trunk.
the end of the output is:
2007-04-12 16:57:20,733 INFO sqlalchemy.engine.base.Engine.0x..b0
SELECT addresses.id_user AS addresses_id_user, addresses.id AS
addresses_id, addresses.addr AS addresses_addr
FROM addresses, users
WHERE (users.id = ?) AND us
I'm such a moron. I downloaded the SA source into a "sqlalchemy3"
directory but the SA expects it in a "sqlalchemy" package so it was
internaly loading the old 0.2.8 Ubuntu version.
Sorry! :-)
Michael Bayer napsal(a):
>
> On Apr 12, 2007, at 12:53 PM, ml wrote:
>
>> I tried s.query(Address).s
> conn = mysql.db.connect()
>
>
>
> conn.close()
Thanks. That fixed the problem. Is sqlalchemy using a connection pool
when I do this or is a new connection opened and closed each time?
Vineet
--~--~-~--~~~---~--~~
You received this message because y
See attachment. Tested against 0.3.6.
Michael Bayer napsal(a):
>
> On Apr 12, 2007, at 12:53 PM, ml wrote:
>
>> I tried s.query(Address).select_by(user=u) as I found similar in the
>> documentation
>> (http://www.sqlalchemy.org/docs/
>> datamapping.html#datamapping_selectrelations_relselectby
On Apr 12, 2007, at 2:03 PM, jason kirtland wrote:
>
>
> The 'analysis' relation is backed by a dict-like
> collection_class keyed by the type of instance, and storing them
> in a special list type that updates the ordering attribute.
> 'analysis' isn't accessed directly by user code.
>
> # lo
I'm trying to map a single relation onto multiple properties.
Let's say I'm tracking "ideas", and a numbered list of pros and
cons for each idea:
Idea: beer
Pros:
1. tastes great
2. less filling
Cons:
1. warning: may not be true
Or in SQL:
Table('Ideas', metadata,
Co
On Apr 12, 2007, at 12:53 PM, ml wrote:
> I tried s.query(Address).select_by(user=u) as I found similar in the
> documentation
> (http://www.sqlalchemy.org/docs/
> datamapping.html#datamapping_selectrelations_relselectby)
> but SA raises:
> AttributeError: 'LazyLoader' object has no attribute '
please file a ticket for this. (Query should raise exceptions for
non-ClauseElements passed)
On Apr 12, 2007, at 12:02 PM, Marco Mariani wrote:
>
> I'm not trying the trunk, and it's the first time I use filter_by,
> but I
> guess:
>
> MappedClass.query().filter_by( MappedClass.column_name
it needs to fire off the query to see whats changed when you go to
flush(). otherwise it has no ability to know what needs to be saved.
On Apr 12, 2007, at 11:43 AM, svilen wrote:
>
> while on the same subject, how do i copy one object's relatives to
> another object without loading them all?
just do this:
conn = mysql.db.connect()
conn.close()
On Apr 12, 2007, at 11:34 AM, vinjvinj wrote:
> mysql.conn = mysql.db.connect()
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group
Hi!
Lets have:
##
users_table = Table("users", metadata,
Column("id", Integer, primary_key=True),
Column("user_name", String(16))
)
addresses_table = Table("addresses", metadata,
Column("id", Integer, primary_key=True),
Column("id_user", Integer, ForeignKey("u
I'm having issues with sqlite and DateTime objects with a timezone
attached (python 2.5, SQA 0.3.6, pysqlite-2.3.3,
OS X) crashing, but the code works with postgres. I get the same
issue with Python 2.4.
Given the test code below, with postgres I get
# Via object
1970-01-01 06:30:34+00:
(Apologies for the somewhat long-winded subject line; should cover
the whole question though.)
Hi folks,
I'm new to SQLAlchemy, and rather new to SQL in general, so I've been
stumbling along trying to get a Pylons project of the ground (using
the SQLAlchemy setup as outlined at
http://www.r
On Apr 12, 6:37 pm, svilen <[EMAIL PROTECTED]> wrote:
> how about whatever.in() -> (whatever and False)
> maybe problem with Null then?
(null and false) gives false, so not(null and false) is true. This
means that not_(col.in_()) returns all rows, while
not_(col.in_(nonexistantvalue)) returns all
sorry, ignore this, started a new thread
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [EMAIL PROTECTED]
To unsubscribe from this group, send email to [EMAIL
how do i copy one object's relatives to
another object, and if possible without loading them all?
1. user1.addresses = user2.addreses does not work, it makes them share
the same InstrList
2. user1.addresses = user2.addreses[:] does work, but fires a full
query (maybe with obj-instantiation)
T
I'm not trying the trunk, and it's the first time I use filter_by, but I
guess:
MappedClass.query().filter_by( MappedClass.column_name == 'Foo' )
equates to filter_by(False), because the .c is missing and it's
comparing an UOWProperty to a string, instead of a Column object to a string
Actually
while on the same subject, how do i copy one object's relatives to
another object without loading them all?
user1.addresses = user2.addreses does not work, it makes them share
the same InstrList
user1.addresses = user2.addreses[:] does work, but fires a full query
(maybe with obj-instantiatio
how about whatever.in() -> (whatever and False)
maybe problem with Null then?
On Thursday 12 April 2007 18:23:38 Michael Bayer wrote:
> On Apr 12, 2007, at 9:46 AM, Ants Aasma wrote:
> > On Apr 12, 1:59 am, Michael Bayer <[EMAIL PROTECTED]>
wrote:
> >> agreed, as long as we know that saying "som
> each query, or just returning it to the connection pool via close()
> (which also calls rollback()) and then re-acquiring it from the pool
> as needed.
I have a wrapper function called execute() whcih traps any errors and
then recreates the mysql engine object and tries to resubmit the qry:
de
On Apr 12, 2007, at 10:31 AM, vinjvinj wrote:
> The problem is that the data is not seen by the second application
> server. When I log into to mysql from my desktop I CAN see the data.
> The problem goes away when I restart the application server with sql-
> alchemy. I'm caching the mysql.db co
On Apr 12, 2007, at 9:46 AM, Ants Aasma wrote:
>
> On Apr 12, 1:59 am, Michael Bayer <[EMAIL PROTECTED]> wrote:
>> agreed, as long as we know that saying "somecolumn != somecolumn" is
>> valid and produces False on all dbs (including frequent-offenders
>> firebird and ms-sql) ? (thats how you i
On Apr 12, 2007, at 3:32 AM, svilen wrote:
> it, but if it's once in a blue moon, u'll get one more disappointed
> SA user ;0(.
right, and then i dont find out until i meet them at Pycon ;)
--~--~-~--~~~---~--~~
You received this message because you are subs
On Apr 12, 2007, at 3:30 AM, Kaali wrote:
>
> Thanks for the answers.
>
> I implemented message loading with find_members() kind of method, as
> shown in the documentation link you gave, and it got twice as fast.
> But it's still nowhere near the speed without the ORM.
i get the impression your
On Apr 11, 2007, at 11:15 PM, Arun Kumar PG wrote:
> Hi Michael,
>
> So how can I prevent this as I can't access the lazyload attributes
> in my manager class once I get the result set from DAO as i get no
> parent session/contextual session exists exception.
>
> should I maintain a referenc
Thanks very much, all clear now.
-f
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [EMAIL PROTECTED]
To unsubscribe from this group, send email to [EMAIL PR
same way, recursively: check 1st element
if mylist and isinstance( mylist[0], yourlisttype): ...
or check all elements, or...
On Thursday 12 April 2007 17:52:28 Disrupt07 wrote:
> Thanks. 'if isinstance(your_object,
> sqlalchemy.orm.attributes.InstrumentedList):' was helpful to me.
>
> Now I w
Thanks. 'if isinstance(your_object,
sqlalchemy.orm.attributes.InstrumentedList):' was helpful to me.
Now I want to check if the given list is either a list of elements or
a list of lists.
Example:
list1 = ['a', 'b', 'c']
list2 = [['a', 'b'], ['c', 'd'], ['e']]
How can I check for lists within a
Hi Guys,
I'm stumped with this and would appreciate any insight. I'm using
mysql.db = create_engine('mysql://%s:[EMAIL PROTECTED]/%s' % (config.DB_USER,
config.DB_PASS, config.DB_HOST, config.DB_NAME))
mysql.conn = mysql.db.connect()
mysql.conn.execute(qry)
I have three servers. Two application
On Apr 12, 1:59 am, Michael Bayer <[EMAIL PROTECTED]> wrote:
> agreed, as long as we know that saying "somecolumn != somecolumn" is
> valid and produces False on all dbs (including frequent-offenders
> firebird and ms-sql) ? (thats how you interpreted IN (), right ?)
It works (almost) ok in MSSQ
Disrupt07 wrote
>
> What is sqlalchemy.orm.attributes.InstrumentedList?
>
> I need to use the sqlalchemy.orm.attributes.InstrumentedList type in
> my Python controller methods and need to check if the type of another
> object is of type sqlalchemy.orm.attributes.InstrumentedList. How can
> I d
Hi Michael,
As Simon suggested, I am now using log.except() instead log.error(),
so I hope the next exception will be followed by more information.
Thanks
On 4/11/07, Michael Bayer <[EMAIL PROTECTED]> wrote:
>
>
> On Apr 11, 2007, at 1:46 AM, Roger Demetrescu wrote:
>
> >
> > Hi all,
> >
> >
What is sqlalchemy.orm.attributes.InstrumentedList?
I need to use the sqlalchemy.orm.attributes.InstrumentedList type in
my Python controller methods and need to check if the type of another
object is of type sqlalchemy.orm.attributes.InstrumentedList. How can
I do this? (e.g. using the type() f
just my point of view:
generatively, i would probably do .in_( somelist ), where somelist is
a variable, and it will work fine until that list gets empty. If that
happens frequently, okay, i'll know soon about it and fix it/avoid
it, but if it's once in a blue moon, u'll get one more disappoint
Thanks for the answers.
I implemented message loading with find_members() kind of method, as
shown in the documentation link you gave, and it got twice as fast.
But it's still nowhere near the speed without the ORM. Makes me a bit
sad, as i really liked the ORM system. Maybe if i remove any autom
43 matches
Mail list logo