Re: [sqlalchemy] Custom column + AttributeExtension --> Value parameter empty in set() method of the Extension

2012-07-20 Thread Hector Blanco
Yep, you're right... That's exactly what's happening. The set event is, indeed self._values = [] The issue is that I can't upgrade to SqlAlchemy 0.7... Anyway... thank you for the help... I'll have to look for a workaround... 2012/7/9 Michael Bayer : > > On J

[sqlalchemy] Custom column + AttributeExtension --> Value parameter empty in set() method of the Extension

2012-07-09 Thread Hector Blanco
Hello everyone. I have a class that uses a "custom" column to store a list of strings. The column is saved in the database using a comma sepparated string. When it's loaded into an instance, it "becomes" a list: class Keyword(declarativeBase): __tablename__ = "keywords" _id = Colu

Re: [sqlalchemy] Get all the instances of class A that are using an specific instance of class B (SqlAlchemy 0.6.9)

2012-05-16 Thread Hector Blanco
2 days trying by myself... 20 minutes with your answer... I still don't know why I didn't try what you said... Thank you, Michael 2012/5/16 Michael Bayer : > > On May 16, 2012, at 5:50 PM, Hector Blanco wrote: > >> Hello everybody! >> >> I would like

[sqlalchemy] Get all the instances of class A that are using an specific instance of class B (SqlAlchemy 0.6.9)

2012-05-16 Thread Hector Blanco
Hello everybody! I would like to know if it's possible to create an optimized query that gives all the elements of a class A that have a relationship to an specific class B Here's the thing: I have a pretty simple class "Region" that defines an area in the screen: class Region(declarativeBase)

[sqlalchemy] SqlAlchemy 0.7.4 > Hibrid-properties not showing in NamedTuples when "values" are queried (they are "resolved")

2011-12-11 Thread Hector Blanco
Hello everyone! I am continuing with the migration from SqlAlchemy 0.6.8 to 0.7.4, and I've seen a little difference in behavior. I have a class Product (more or less) like: class Product(declarativeBase): _id = Column("id", Integer, primary_key=True) _model = Column("model", Uni

Re: [sqlalchemy] SqlAclhemy 0.6.8 > Delete orphan with objects that contain new objects (momentarily orphan)?

2011-12-11 Thread Hector Blanco
or you > might have a different flavor of synonym. So need a full reproducing test > case as a trac ticket please thanks ! > > > > > On Dec 11, 2011, at 12:52 AM, Hector Blanco wrote: > >> I would like to. I've been testing 0.7.4, and it seems to work really >> fast,

Re: [sqlalchemy] SqlAlchemy 0.7.4 > Make a hybrid_property a declared_attr

2011-12-11 Thread Hector Blanco
> > The workaround is very simple, just say "A.id==5" instead of "id=5". The > bug itself is fixed in r99564ce1414c. > Ah, yeah! That works! I find using the double "==" for comparison clearer (just a personal opinion) > > > -- > You received this message because you are subscribed to the Goog

[sqlalchemy] SqlAlchemy 0.7.4 > Make a hybrid_property a declared_attr

2011-12-11 Thread Hector Blanco
Hello everyone! I'm trying to migrate from SqlAlchemy 0.6.8 to 0.7.4. I have a class that is the base for all the bases in my system. In that class is where I define the id (numeric primary key) for the rest of my classes. That class is not mapped to any table. I want to have getter/setter for s

Re: [sqlalchemy] SqlAclhemy 0.6.8 > Delete orphan with objects that contain new objects (momentarily orphan)?

2011-12-10 Thread Hector Blanco
that this particular check is unnecessary, and you should upgrade to 0.7. > > > On Dec 11, 2011, at 12:00 AM, Hector Blanco wrote: > >> Thank you for your reply. >> >> I'm not exactly sure of what is blocking the insert. I would say >> SqlAlchemy, because m

Re: [sqlalchemy] SqlAclhemy 0.6.8 > Delete orphan with objects that contain new objects (momentarily orphan)?

2011-12-10 Thread Hector Blanco
d... written in the database when I start loading the child Again, thank you 2011/12/10 Michael Bayer : > > On Dec 10, 2011, at 7:07 PM, Hector Blanco wrote: > >> >> >> That data (is JSON) is sent to the Category "handler". That handler >> does the foll

[sqlalchemy] SqlAclhemy 0.6.8 > Delete orphan with objects that contain new objects (momentarily orphan)?

2011-12-10 Thread Hector Blanco
Sorry, I messed up the subject of the email -- Forwarded message -- From: Hector Blanco Date: 2011/12/10 Subject: SqlAclhemy 0.6.8 To: sqlalchemy@googlegroups.com Hello everyone! In my application, I have a class Product that can belong to a Category. (1 product, 1 category

[sqlalchemy] SqlAclhemy 0.6.8

2011-12-10 Thread Hector Blanco
Hello everyone! In my application, I have a class Product that can belong to a Category. (1 product, 1 category). The category knows which products belong to it thanks to a backref. A product can not exist if it doesn't belong to a category. If a category is deleted, all it's products are deleted

Re: [sqlalchemy] SQLA 0.6.8 > Given an AssociationProxy, how can I get the class it would give me?

2011-12-08 Thread Hector Blanco
r), check whether it's an AssociationProxy, and then do what it is described in Michael's solution, but maybe someone knows a cleaner way? Thank you in advance! Thanks in advance! 2011/12/7 Michael Bayer : > > On Dec 7, 2011, at 7:53 PM, Hector Blanco wrote: > >> Hello

Re: [sqlalchemy] SQLA 0.6.8 > Given an AssociationProxy, how can I get the class it would give me?

2011-12-07 Thread Hector Blanco
Yes! Thank you for your, as usual :-) , quick, wise and right reply! I believe that's all I need. I already have in place all the machinery to deal with Columns, relationships, and stuff like that! Awesome (or as we would pronounce in my mother tongue, Spanish... osom!! ) 2011/12/7 Michael Bayer

[sqlalchemy] SQLA 0.6.8 > Given an AssociationProxy, how can I get the class it would give me?

2011-12-07 Thread Hector Blanco
Hello everyone: In one of my classes, I am using an associationproxy to provide a list in which the same item can be inserted twice. Basically, a product can contain "images" (several times the same image). One product can have two different lists of "images" (images1 and images2... yep... not ve

Re: [sqlalchemy] SqlAlchemy 0.6.8 > Initiatior in AttributeExtension

2011-12-01 Thread Hector Blanco
@validates... Where have you been? Oh... In the documentation, all along. The day I learn to read, I'll conquer the world It works great. Thank you! 2011/12/1 Michael Bayer : > > On Nov 30, 2011, at 7:48 PM, Hector Blanco wrote: > >> Hello everyone! >> >> I a

[sqlalchemy] SqlAlchemy 0.6.8 > Initiatior in AttributeExtension

2011-11-30 Thread Hector Blanco
Hello everyone! I am using (yeah, still) SqlAlchemy 0.6.8 and I'm using an AttributeExtension to build permissions of users. My users get the permissions depending on the UserGroup they're in. The user has the typical relationship towards "UserGroup". My classes: -- User.py-

[sqlalchemy] Customized order_by in tree of Mixins relationship

2011-11-19 Thread Hector Blanco
Hi everyone: I have an object structure that uses (heavily) object orientation. I have a "BaseObject" class that is the class for three kinds of subclasses, "Element1", "Element2" and "Element3". In my application I have a tree of "BaseObject" elements: class BaseObject(declarative): __t

Re: [sqlalchemy] serialize list

2011-09-13 Thread Hector Blanco
I'm not sure if this will be helpful, but I found the types decorators very useful : http://www.sqlalchemy.org/docs/core/types.html#typedecorator-recipes You can basically keep a list() in your instances and do something when you want to save it in the database (such as saving them as a comma sep

Re: [sqlalchemy] or_(MyClass.relationship1.contains(item), MyClass.relationship2.contains(item)) returns empty list

2011-05-26 Thread Hector Blanco
and how any() and outerjoin() are more appropriate if OR > conjunctions are used: > > http://www.sqlalchemy.org/docs/orm/internals.html#sqlalchemy.orm.properties.RelationshipProperty.Comparator.contains > > > On May 24, 2011, at 7:51 PM, Hector Blanco wrote: > >> Hello everybody

[sqlalchemy] or_(MyClass.relationship1.contains(item), MyClass.relationship2.contains(item)) returns empty list

2011-05-24 Thread Hector Blanco
Hello everybody... Let's say I have a class like this: class Foo(declarativeBase): bars1 = relationship(Bar.Bar, secondary=foos_to_bars1, collection_class=set()) bars2 = relationship(Bar.Bar, secondary=foos_to_bars2, collection_class=list()) At a certain point, I want to get instance

[sqlalchemy] Get instances of certain type in a relationship that can contain objects of several types

2011-05-14 Thread Hector Blanco
Hello everyone! I have an application with a "BaseVisibilizer" class that is base class for two other classes: class BaseVisibilizer(declarativeBase): __tablename__ = "base_visibilizers" _polymorphicIdentity = Column("polymorphic_identity", String(20), key="polymorphicIdentity")

[sqlalchemy] No idea of why an instrumented list seems to be behaving like a set

2011-04-13 Thread Hector Blanco
Hello everyone... I'm experiencing an strange behavior with an instrumented list... On one hand, I have a class called "BaseMedia" that is the base type for Images, Videos... On the other hand I have a class "Schedule" that is the base class for "schedulable" things in my system and then I have so

Re: [sqlalchemy] Execute a function "on orphan"

2011-04-11 Thread Hector Blanco
That is what I was looking for! http://www.sqlalchemy.org/docs/orm/interfaces.html?highlight=attributeextension#sqlalchemy.orm.interfaces.AttributeExtension Thank you very much! 2011/4/10 Michael Trier : > On Sat, Apr 9, 2011 at 10:32 PM, Hector Blanco > wrote: >> >> Unassigni

Re: [sqlalchemy] Execute a function "on orphan"

2011-04-09 Thread Hector Blanco
Unassigning a user from its userGroup, indeed, puts the UserGroup in that user to NULL. But it turns out that the entity that controls the permissions is a third thing. That "thing" takes some fields of the User class (id, name...) and generates an instance of a third object which is in charge of c

[sqlalchemy] Execute a function "on orphan"

2011-04-09 Thread Hector Blanco
Hello everyone! I have an application with Users and UserGroups... The users have certain permissions to do stuff in the application depending on the UserGroup they belong to. The relationship is as follows: -- class User(BaseClass.BaseClass, Database.Base):

Re: [sqlalchemy] Navigate through tree-like structure with sqlalchemy. Is it doable (now) ?

2011-04-08 Thread Hector Blanco
Thanks for the quick reply. I'll give it a try. 2011/4/8 Michael Bayer : > > On Apr 8, 2011, at 12:12 PM, Hector Blanco wrote: > >> Hello everyone: >> >> I have a tree-like structure (groups/nodes, basically) with Stores and >> StoreGroups. An store can

[sqlalchemy] Navigate through tree-like structure with sqlalchemy. Is it doable (now) ?

2011-04-08 Thread Hector Blanco
Hello everyone: I have a tree-like structure (groups/nodes, basically) with Stores and StoreGroups. An store can belong only to one storeGroup, but an StoreGroup can contain stores or other storeGroups: class StoreGroup(BaseClass.BaseClass, Database.Base): """Represents a storeGroup"""

[sqlalchemy] Querying with "not" - the python way (the same way python behaves)

2011-03-24 Thread Hector Blanco
Hello everyone. I was wondering what is the best way to perform a query filtering by "not" in a python-way. In python: >> not(None) True >> not(list()) True Let's say I have a class that has the typical "children" relationship: class Foo(declarative_base): __tablename__ = "foos"

Re: [sqlalchemy] I'm missing something with the session...

2011-03-24 Thread Hector Blanco
ckages you mentioned. Looks like they might be helpful Thanks! 2011/3/24 Wichert Akkerman : > 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, rea

Re: [sqlalchemy] Trying to put a relationship N:M in Mixin (base) class

2011-03-23 Thread Hector Blanco
Yeeey!! It works! I had to deal with the primaryjoins/secondaryjoins thing but it worked. I'm attaching it, just in case it can help someone else! 2011/3/23 Hector Blanco : > Thank you so much! > > I'll let you know! > > P.S.: >    just create the m2m table fo

Re: [sqlalchemy] Trying to put a relationship N:M in Mixin (base) class

2011-03-23 Thread Hector Blanco
Thank you so much! I'll let you know! P.S.: just create the m2m table for the relationship as needed. ... and this is another evidence that my brain is not 100% functional... Why didn't it occur to me? I dunno... 2011/3/23 Michael Bayer : > > On Mar 23, 2011, at 5:47 P

Re: [sqlalchemy] I'm missing something with the session...

2011-03-23 Thread Hector Blanco
stopped the server) That was me: http://groups.google.com/group/sqlalchemy/browse_thread/thread/5a3c7c8056cf6a60/6805bbe38667b9be?lnk=gst&q=Hector+Blanco#6805bbe38667b9be That's why I decided to commit, close, and such as soon as possible (leave the sessions opened as little as possible) Th

[sqlalchemy] Trying to put a relationship N:M in Mixin (base) class

2011-03-23 Thread Hector Blanco
Hello everyone. I have a kind of "virtual" class that I want to use as base class for all the elements that are going to be stored in the database. Initially I had: -- BaseClass.py -- class BaseClass(object): _id = Column("id", Integer, primary_key=True, key="id")

[sqlalchemy] I'm missing something with the session...

2011-03-23 Thread Hector Blanco
Hello everyone... I am getting detached instances error and I don't really know why. There's something I don't get with the session, but I have been reading the documentation thoroughly, trying many things and I can't get rid of all the DetachedInstance exceptions... That's why I think I'm doing s

[sqlalchemy] Re: Getting instances that contains other instances in an N:M relationship

2011-03-17 Thread Hector Blanco
ar.gz?download) In the examples/association/basic_association.py file. Nice!. P.S.: Now I'm a little bit down, because I've spent one whole day figuring out something that is explained inside a file called "basic_association"... :-D What will be an "advanced_association"

[sqlalchemy] Re: Getting instances that contains other instances in an N:M relationship

2011-03-16 Thread Hector Blanco
e 'corresponding_column' In some other cases I get "Store"s (instances) but they are not properly filtered. It looks like it's getting all the stores assigned to any userGroup, without filtering by the user id... Now I'm kind of lost. Thank you in advance! 2011/3/16 Hecto

[sqlalchemy] Re: Getting instances that contains other instances in an N:M relationship

2011-03-16 Thread Hector Blanco
someone :) 2011/3/16 Hector Blanco : > Hello everyone! > > In my application I have a class "Store" that can contain several > "UserGroup"s (for permission purposes) and one "UserGroup" can belong > to several "Stores". > > I want to

[sqlalchemy] Getting instances that contains other instances in an N:M relationship

2011-03-16 Thread Hector Blanco
Hello everyone! In my application I have a class "Store" that can contain several "UserGroup"s (for permission purposes) and one "UserGroup" can belong to several "Stores". I want to get the "Stores" that contain a certain "UserGroup" (instance): I have it modeled like this: class Store(declara

Re: [sqlalchemy] Re: Query a value that is a relationship

2011-03-02 Thread Hector Blanco
I see... I'll work something out. Thank you Mr. Bayer!! 2011/3/1 Michael Bayer : > > On Mar 1, 2011, at 5:50 PM, Hector Blanco wrote: > > Hello everyone: > > Let's say I have a class "User"  and a class "UserGroup". One user can > belong to one

[sqlalchemy] Re: Query a value that is a relationship

2011-03-01 Thread Hector Blanco
Hello everyone: Let's say I have a class "User" and a class "UserGroup". One user can belong to one userGroup, an a userGroup can contain several users (pretty typical structure). It's a simple relationship I got modeled like: class UserGroup(declarativeBase): """Represents a group of use

[sqlalchemy] Query a value that is a relationship

2011-03-01 Thread Hector Blanco
Hello everyone: Let's say I have a class "User" and a class "UserGroup". One user can belong to one userGroup, an a userGroup can contain several users (pretty typical structure). It's a simple relationship I got modeled like: class UserGroup(declarativeBase): """Represents a group of us

Re: [sqlalchemy] Find whether a synonym "points" to a foreign key or a relationship (Looking for your blessing)

2011-02-28 Thread Hector Blanco
uggestion... whatever! you may have will be very appreciated... As usual, thank you so much! 2011/2/27 Michael Bayer : > > On Feb 27, 2011, at 6:45 PM, Hector Blanco wrote: > >> A few days ago I asked what appears in the body of the message, a few >> lines below. To summarize: &

Re: [sqlalchemy] Find whether a synonym "points" to a foreign key or a relationship (Looking for your blessing)

2011-02-27 Thread Hector Blanco
" in a set (for the method that tries to get relationships, that set would be set("_userGroup") and for the one that tries to get foreign keys, set("_userGroupId")) . In a second "for" loop they match that "underscored" name with the name of the sy

Re: [sqlalchemy] Backrefs vs. defining the relationships "by hand"

2011-02-24 Thread Hector Blanco
now I won't sleep soundly at night until I change all my code... But hey... This is what learning while coding has :-) I will have to "expunge" my old ideas from my brain and update my code... I hope I can quickly flush the changes, though Thank you! 2011/2/24 Michael Bayer : > &

[sqlalchemy] Backrefs vs. defining the relationships "by hand"

2011-02-24 Thread Hector Blanco
Hello everyone... I'd like to know what do you think it's better: Whether using backrefs or "manually" defining the relationships one by one. Are the backrefs useful to code less code or do they have other advantages? I.e.: Let's say I have a User and a UserGroup class with (initially) the relati

[sqlalchemy] Re: Filtering by a foreign key (now, without typo).

2011-02-20 Thread Hector Blanco
It was working from gecko... I hadn't considered my dumbness.. I went trough all the records in my database and it turns out I was having way more WhateverClass in the ContainerClass with id == 5 than I thought!!! It was working from the beginning! 2011/2/12 Hector Blanco : > Sorry... I

[sqlalchemy] Re: Optimize a search in several classes (each of them with simple 1:N relationships)

2011-02-20 Thread Hector Blanco
Amazing: session.query(Cashier.Cashier).join(Register.Register).join(Store.Store).all() I hadn't tried before because I thought it would be too straight forward... 2011/2/16 Hector Blanco : > Hello everyone! > > I have a class structure like this: > > class S

Re: [sqlalchemy] Find whether a synonym "points" to a foreign key or a relationship

2011-02-18 Thread Hector Blanco
I'll give it a try!! Thank you! 2011/2/18 Michael Bayer : > > On Feb 17, 2011, at 6:37 PM, Hector Blanco wrote: > >> Hello everyone! >> >> Let's say I have a class defined like this: >> >> class User(declarativeBase): >>      

[sqlalchemy] Find whether a synonym "points" to a foreign key or a relationship

2011-02-17 Thread Hector Blanco
Hello everyone! Let's say I have a class defined like this: class User(declarativeBase): """Represents a user""" __tablename__ = "users" _id = Column("id", Integer, primary_key=True) _phone = Column("phone", String(16)) _userName = Column("user_name", Stri

Re: [sqlalchemy] Need Urgent Help - SQLAlchemy Relation

2011-02-17 Thread Hector Blanco
Just a wild guess, but have you tried making your association table like: #association table user_group_table = Table('t_user_group', metadata,    Column('user_id', Integer, ForeignKey('t_user.c.user_id',        onupdate="CASCADE", ondelete="CASCADE")),    Column('group_id', Integer, ForeignKey('t

[sqlalchemy] Optimize a search in several classes (each of them with simple 1:N relationships)

2011-02-16 Thread Hector Blanco
Hello everyone! I have a class structure like this: class Store(declarativeBase): __tablename__ = "stores" id = Column("id", Integer, primary_key=True) name = Column("name", String(50)) registers = relationship("Register", cascade="all, delete", collection_class=s

[sqlalchemy] Filtering by a foreign key (now, without typo).

2011-02-12 Thread Hector Blanco
Sorry... I just sow a typo: Hello everyone. I am trying to get classes whose foreign key is "whatever" but I always get all the entries in the database, instead of the ones that match the criterion. Let's say I have a couple of classes using declarative base in a relationship N:1. I have that m

[sqlalchemy] Filtering by a foreign key.

2011-02-12 Thread Hector Blanco
Hello everyone. I am trying to get classes whose foreign key is "whatever" but I always get all the entries in the database, instead of the ones that match the criterion. Let's say I have a couple of classes using declarative base in a relationship N:1. I have that modeled like: class OtherClass

Re: [sqlalchemy] Pass query with as parameter (avoid creating a method and hardcoding a query)

2011-01-27 Thread Hector Blanco
2011/1/16 Tamás Bajusz : > Is your work available, or do you plan to put it public somewhere? > Mmm... maybe... contact me privately if you're interested -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch

Re: [sqlalchemy] Inserting in a container class that behaves as list (or set) from the contained class (not from the container)

2011-01-21 Thread Hector Blanco
y... if my idea is not wrong, I'll check if the error is somewhere else. It's good to know that I'm going in the right direction! Thank you! 2011/1/21 A.M. : > > On Jan 21, 2011, at 12:29 PM, Hector Blanco wrote: > >> Hello list! >> >> I have a couple of

[sqlalchemy] Inserting in a container class that behaves as list (or set) from the contained class (not from the container)

2011-01-21 Thread Hector Blanco
Hello list! I have a couple of classes. One of the behaves as the container of the other: class ContainerOfSamples(declarativeBase): __tablename__ = "containers" _id = Column("id", Integer, primary_key=True) _samples = relationship("Samples", cascade="all, delete", colle

Re: [sqlalchemy] Re: sqlalchemy rocks my socks off!

2011-01-20 Thread Hector Blanco
+1 2011/1/16 Jan Müller : > +1 > > On Jan 15, 9:58 am, Eric Ongerth wrote: >> +1 >> >> On Jan 13, 5:08 pm, rdlowrey wrote: >> >> >> >> >> >> >> >> > To Michael Bayer: sqlalchemy simplifies my life every day and makes me >> > vastly more productive! Many thanks. > > -- > You received this message

Re: [sqlalchemy] Get python type from sqlalchemy.orm.synonym

2011-01-16 Thread Hector Blanco
Thanks for replying so quickly... > if the user says "number == '5' ", why not consider that to be a string ?   > why is casting needed ?  if they want an int, they should type an int, no ? > I don't trust my users :-) I don't think they know what they want, most of the times :-D >> >> The probl

[sqlalchemy] Get python type from sqlalchemy.orm.synonym

2011-01-16 Thread Hector Blanco
Hello everyone! I have created a little module that generates a sqlalchemy query from an string (yeah, I needed some help: http://groups.google.com/group/sqlalchemy/browse_thread/thread/6ea3241b1c653444 ) At certain point, I check the type of the field I'm filtering by creating an instance of the

Re: [sqlalchemy] Pass query with as parameter (avoid creating a method and hardcoding a query)

2011-01-16 Thread Hector Blanco
f the comparator for the field/synonym (if I wanted to check for "model == 'foo'", I needed to get: getattr(Product.model, "__eq__"). Yey!! It works! Thank you so much!! 2011/1/16 Michael Bayer : > > On Jan 15, 2011, at 10:53 PM, Hector Blanco wrote: > >&g

[sqlalchemy] Pass query with as parameter (avoid creating a method and hardcoding a query)

2011-01-15 Thread Hector Blanco
Hello list... I would like to allow the users to perform certain queries without me (or well... my server) knowing in advance what those queries are going to be (without hard-coding the query). For instance: I have a “Product” class. One of it's fields is "manufacturer" and another is "model" cl

Re: [sqlalchemy] Pass relationships to joinedload(ing) in a parameter

2011-01-03 Thread Hector Blanco
Works like a charm! Thank you! (once again) 2011/1/3 Michael Bayer : > I'd keep each path separate, i.e. > > query.options(*[joinedload_all(path) for path in relationshipsToPreLoad]) > > > On Jan 3, 2011, at 10:55 AM, Hector Blanco wrote: > >> Hi list! >>

[sqlalchemy] Pass relationships to joinedload(ing) in a parameter

2011-01-03 Thread Hector Blanco
Hi list! I am facing a little problem whose I'm sure has a very simple solution, but I haven't been able to find it (the solution, I mean)... I would like to be able to pass the fields (relationships) I want to pre-load as a parameter. Let's say I have a couple of classes: --

Re: [sqlalchemy] Database in inconsistent state in user data (login in a web server) retrieval

2010-12-23 Thread Hector Blanco
With that (catching all the errors) seems to work better. It also seems that the "problem" improves if I wait a bit (4 or 5 seconds) after the server is started... 2010/12/23 Hector Blanco : > Ok! I'll let you know... > > Thank you so much! > > It seems to fail

Re: [sqlalchemy] Database in inconsistent state in user data (login in a web server) retrieval

2010-12-23 Thread Hector Blanco
he > Python warnings filter to emit those warnings as exceptions, in which you > should be able to get stack traces in your logs. > > > On Dec 23, 2010, at 3:02 PM, Hector Blanco wrote: > >> Thank you for your quick reply! >> >> I tried to change the

Re: [sqlalchemy] Database in inconsistent state in user data (login in a web server) retrieval

2010-12-23 Thread Hector Blanco
t creates the database, a new User() instance is created, with a few default values (userName = test, for instance) and it's added to the database using this "update" method (said user doesn't have an id, so it should be added using add(user) ). Then I try to login with the user &quo

[sqlalchemy] Database in inconsistent state in user data (login in a web server) retrieval

2010-12-23 Thread Hector Blanco
Hello everyone! I am currently working with a webserver (Grok) that starts different threads (automatically) for the requests that arrive to it. The information is serialized in a MySQL database (which is acceded through SqlAlchemy). The users' information is stored in that MySQL database. The pl

Re: [sqlalchemy] Get "properties" of a class mapped with SqlAlchemy (and its "sqlalchemy.orm.synonym")

2010-12-21 Thread Hector Blanco
mapper.iterate_properties ? > > > On Dec 21, 2010, at 11:14 AM, Hector Blanco wrote: > >> I found a "maybe" way... but I don't know if it's good idea... the >> "propertyProxy" instances have

Re: [sqlalchemy] Get "properties" of a class mapped with SqlAlchemy (and its "sqlalchemy.orm.synonym")

2010-12-21 Thread Hector Blanco
--- That works... Properties found: '['id', password', 'userName']' ...but I don't really know what I'm exactly touching here... (and how "dangerous"... or correct it may be) 2010/12/21 Hector Blanco : > First of all, thank y

Re: [sqlalchemy] Get "properties" of a class mapped with SqlAlchemy (and its "sqlalchemy.orm.synonym")

2010-12-21 Thread Hector Blanco
instance_state", "_id", "_userName", "_password"]), then check if these variables are instrumented ("_sa_instance_state" isn't) and then check if the class has the attributes ["id", "userName" and "password"] but

[sqlalchemy] Get "properties" of a class mapped with SqlAlchemy (and its "sqlalchemy.orm.synonym")

2010-12-20 Thread Hector Blanco
Hello all! I have an application running under Python2.6 and the classes are set up with properties (in a Python2.4 style, though). Everything seems to be working fine with SqlAlchemy (version 0.6.5, just in case) as it explains here: http://www.sqlalchemy.org/docs/orm/extensions/declarative.html

Re: [sqlalchemy] Re: Modeling a Tree-looking structure in SqlAlchemy.

2010-12-15 Thread Hector Blanco
Thank you all... As soon as I have the webserver where I'm going to use that structure up and running, I'll try it and i'll let you know... 2010/12/13 Laurent Rahuel : > Hello, > > You should also take a look at http://pypi.python.org/pypi/sqlamp/0.5.2, an > implementation of Materialized Path fo

[sqlalchemy] Modeling a Tree-looking structure in SqlAlchemy.

2010-12-13 Thread Hector Blanco
hello everyone! I was wondering which is the best way to model a tree-looking structure with SqlAlchemy. Right now, I have this two classes: #!/usr/bin/python2.6 class MyNode(object): def __init__(self): self.items = list()

Re: [sqlalchemy] Inheriting custom collection to create another custom collection. Issues with the appenders/parents

2010-11-15 Thread Hector Blanco
ate your effort! :) I'll keep you posted! 2010/11/13 jason kirtland : > Hi Hector, > > On Fri, Nov 12, 2010 at 7:46 AM, Hector Blanco wrote: >> Hello everyone. >> >> I was wondering if it's possible to inherit a custom collection to >> create another cust

Re: [sqlalchemy] Re: Two relationships with a same backref "name". Is that (even) possible or I got everything wrong?

2010-11-12 Thread Hector Blanco
ld/ be handled as just another > relationship on the opposite mapper. > > On Nov 12, 7:31 am, Hector Blanco wrote: >> 2010/11/12 Eric Ongerth : >> >> > Hi Hector, >> >> > If I'm not mistaken, everywhere you wrote >> > (MyObject.id==MyObject.

[sqlalchemy] Inheriting custom collection to create another custom collection. Issues with the appenders/parents

2010-11-12 Thread Hector Blanco
Hello everyone. I was wondering if it's possible to inherit a custom collection to create another custom collection. A few days ago I was trying to use my own class as a custom_collection (http://groups.google.com/group/sqlalchemy/msg/ba1c64c3d227f586). Thanks to Michael Bayer I w

Re: [sqlalchemy] Re: Two relationships with a same backref "name". Is that (even) possible or I got everything wrong?

2010-11-12 Thread Hector Blanco
2010/11/12 Eric Ongerth : > Hi Hector, > > If I'm not mistaken, everywhere you wrote > (MyObject.id==MyObject.containerId), > you meant to write: (Container.id==MyObject.containerId). > Ups... yeah... great eye. > Instead of the backref technique, why not just create the MyObject-- >>Container re

[sqlalchemy] Two relationships with a same backref "name". Is that (even) possible or I got everything wrong?

2010-11-11 Thread Hector Blanco
I have a class that has two relationships to the same type of objects. One of the relationships will store objects of type "VR" and the other objects with a type "CC". One object can only be in one of the lists (relationships) at the same time: This is the "container" class and its two relationshi

Re: [sqlalchemy] (Newbie) Using a custom collection extending from a dict(). Is that doable?

2010-11-09 Thread Hector Blanco
nly) * Using strings or callables as primaryjoin/secondaryjoin arguments in a relationship() - but I'd like to understand a little bit more how does it work (what's going on internally) so I won't make similar errors in the future. Thank yo

[sqlalchemy] (Newbie) Using a custom collection extending from a dict(). Is that doable?

2010-11-08 Thread Hector Blanco
Hello everyone... I'm trying to use a custom collection to "connect" (or relate) two classes but I haven't been able to do it. Maybe I got the whole concept of the custom collections wrong, but let me explain what I am doing (and see if someone can give me a hint, or something) I have a Parent cl

[sqlalchemy] [Solved? ] Creating a simple 1:2 relationship with MeGrok and SqlAlchemy

2010-11-01 Thread Hector Blanco
Hi List... I have been asking a lot lately about a 1:2 relationship with MeGrok and SqlAlchemy, and I think I've solved it. I have created a mini how to just in case it could help anyone. ODT > http://www.hectorblanco.org/files/odt/Megrok%20Relation%201:2.odt PDF > http://www.hectorblanco.org/fi

Re: [sqlalchemy] Simple relationship 1:1 fails with "Foreign key assocated with column ------- could not find table"

2010-11-01 Thread Hector Blanco
Oh, and regarding the other part of your answer: > > These class definitions should be merged with those in Tables.py. You should > only have one "class Parent" statement and one "class Child" statement. You > may be confusing this with the non-declarative class setup, where you define > the table

Re: [sqlalchemy] Relationship between a class with two different instances of other class (Newbie)

2010-11-01 Thread Hector Blanco
-relations-11-or-one-12), and someone said it's more correct this last approach (of keeping the parent_id in the children and distinguish the type of the children through a Child.type field). 2010/10/29 Conor : > On 10/29/2010 11:51 AM, Hector Blanco wrote: > > Thanks Conor! > >

Re: [sqlalchemy] Simple relationship 1:1 fails with "Foreign key assocated with column ------- could not find table"

2010-11-01 Thread Hector Blanco
lse, assert_unicode=None, unicode_error=None, _warn_on_bytestring=False), table=), schema='test')} As you can see, the parent table appears as "test.parents_table", not "parents_table". I don't think this was SqlAlchemy "fault", but more the megrok.rdb thing

Re: [sqlalchemy] Simple relationship 1:1 fails with "Foreign key assocated with column ------- could not find table"

2010-10-30 Thread Hector Blanco
as there) but I don't think that under any concept re-writing code is a good idea so I'll try to change it. Thank you for the very well explained and detailed reply. 2010/10/29 Conor : > On 10/29/2010 05:31 PM, Hector Blanco wrote: > > Hello, group! > > I am still deal

[sqlalchemy] Simple relationship 1:1 fails with "Foreign key assocated with column ------- could not find table"

2010-10-29 Thread Hector Blanco
Hello, group! I am still dealing with the relationship I asked before (http://groups.google.com/group/sqlalchemy/browse_thread/thread/c1d46daf35116999). To tell the truth, I'm not even sure if this is a question I should ask in the SqlAlchemy forum because I'm also dealing with Megrok.rdb (http:/

Re: [sqlalchemy] Relationship between a class with two different instances of other class (Newbie)

2010-10-29 Thread Hector Blanco
ing ones. The way I asked in my former question would imply creating a new relationship AND adding a new foreign key to the parent. I'd like to know what people that know much more about databases think :) 2010/10/29 Conor : > On 10/29/2010 09:43 AM, Hector Blanco wrote: > > Hello

[sqlalchemy] Relationship between a class with two different instances of other class (Newbie)

2010-10-29 Thread Hector Blanco
Hello list... I wrote a couple of days ago about how to model an structure of three classes (http://groups.google.com/group/sqlalchemy/browse_thread/thread/5ba5c4ad16f789d6#). I thing I almost have it, but I am still getting problems mapping an structure like this. class Child(rdb.Model):

[sqlalchemy] Containers/collections with SQLAlchemy

2010-10-26 Thread Hector Blanco
Hi group! I am trying to migrate my application from ZopeDB to MySql. I am using sqlalchemy under megrok.rdb. I have a class which inherits from list() and has a few extra methods. Reading the chapter about custom collections in sqlalchemy (http://www.sqlalchemy.org/docs/orm/collections.html#cust

[sqlalchemy] Re: Automatically execute a procedure on saving/loading from Sql database with SQLAlchemy (and MeGrok)

2010-10-25 Thread Hector Blanco
I hate when the identation gets messed up... Gonna try again: Yuuup... It works like a charm! I have created a simple class that gets a dictionary and "serializes" its values. The underlying database is MySql... Just in case my code may help someone (or if someone has any suggestions...) here it

[sqlalchemy] Re: Automatically execute a procedure on saving/loading from Sql database with SQLAlchemy (and MeGrok)

2010-10-25 Thread Hector Blanco
Yuuup... It works like a charm! I have created a simple class that gets a dictionary and "serializes" its values. The underlying database is MySql... Just in case my code may help someone (or if someone has any suggestions...) here it goes: from sqlalchemy import types import logging log = loggi

[sqlalchemy] Automatically execute a procedure on saving/loading from Sql database with SQLAlchemy (and MeGrok)

2010-10-25 Thread Hector Blanco
Hello everyone. First of all, thank you for reading this (no matter whether you can/want to help me or not) :-) Second, the question: I am using sqlalchemy under MeGrok (http://pypi.python.org/pypi/megrok.rdb) to have my Python/Grok classes stored over a RDBMS (MySql) database. I have a Python

[sqlalchemy] Re: Automatically execute a procedure on saving/loading from Sql database with SQLAlchemy (and MeGrok)

2010-10-25 Thread Hector Blanco
Wow... I just saw this... http://www.sqlalchemy.org/docs/05/reference/sqlalchemy/types.html#sqlalchemy.types.TypeDecorator Maybe that's what I need! I'll confirm (for future questions) :-) 2010/10/25 Hector Blanco > Hello everyone. > > First of all, thank you for reading this