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

2012-07-20 Thread Hector Blanco
, at 12:38 PM, Hector Blanco wrote: 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__

[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 =

[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):

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 mike...@zzzcomputing.com: On May 16, 2012, at 5:50 PM, Hector Blanco wrote: Hello everybody! I would like to know if it's possible

[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

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 Google Groups

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

2011-12-11 Thread Hector Blanco
, 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, but my code is heavily dependent on Synonyms, which seem to be incompatible with certain new features (I'm getting errors when I use order_by, for instance) so, until I have time

[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,

[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

[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 white.li...@gmail.com 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

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

2011-12-10 Thread Hector Blanco
start loading the child Again, thank you 2011/12/10 Michael Bayer mike...@zzzcomputing.com: 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 following 1) Creates a new Category() instance, 2) Fill the non-relationship

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

2011-12-10 Thread Hector Blanco
in 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 my Foreign Keys are nullable (which raises the question

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
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 mike...@zzzcomputing.com: On Dec 7, 2011, at 7:53 PM, Hector Blanco wrote: Hello everyone: In one of my classes, I am using an associationproxy

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

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 mike...@zzzcomputing.com: On Nov 30, 2011, at 7:48 PM, Hector Blanco wrote: Hello everyone! I am using (yeah, still

[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: --

[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):

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

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... Let's say I have a class like

[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

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 mtr...@gmail.com: On Sat, Apr 9, 2011 at 10:32 PM, Hector Blanco white.li...@gmail.com wrote

[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] 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

[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

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 mike...@zzzcomputing.com: 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 belong only to one storeGroup

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

2011-03-24 Thread Hector Blanco
. Looks like they might be helpful Thanks! 2011/3/24 Wichert Akkerman wich...@wiggy.net: 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] 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 _name =

[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

[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) def

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

2011-03-23 Thread Hector Blanco
that stopped the server) That was me: http://groups.google.com/group/sqlalchemy/browse_thread/thread/5a3c7c8056cf6a60/6805bbe38667b9be?lnk=gstq=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) The problem

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

2011-03-23 Thread Hector Blanco
PM, Hector Blanco wrote: Hello everyone. class BaseClass(object):       sqlRelationships_accelerator = None       internalAttrs_accelerator = None       properties_accelerator = None       _id = Column(id, Integer, primary_key=True, key=id)       @classmethod       def

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 white.li...@gmail.com: Thank you so much! I'll let you know! P.S.:    just create the m2m table for the relationship

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

2011-03-17 Thread Hector Blanco
) 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?? 2011/3/16 Hector Blanco white.li...@gmail.com: Hello

[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 UserGroups (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(declarativeBase):

[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 white.li...@gmail.com: Hello everyone! In my application I have a class Store that can contain several UserGroups (for permission purposes) and one UserGroup can belong to several Stores. I want to get the Stores that contain a certain UserGroup (instance

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

2011-03-16 Thread Hector Blanco
kind of lost. Thank you in advance! 2011/3/16 Hector Blanco white.li...@gmail.com: Hello everyone! In my application I have a class Store that can contain several UserGroups (for permission purposes) and one UserGroup can belong to several Stores. I want to get the Stores that contain

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 mike...@zzzcomputing.com: 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 userGroup, an a userGroup can contain

[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 users

[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 users

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

2011-02-28 Thread Hector Blanco
may have will be very appreciated... As usual, thank you so much! 2011/2/27 Michael Bayer mike...@zzzcomputing.com: 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: Let's say I have a class

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

2011-02-27 Thread Hector Blanco
to userGroupId) They seem to work, at least with my not-complicated-at-all classes, but I'd like to know what do you guys think of my approach. Is it good? Can it break something? Is there a better way? Thank you! 2011/2/18 Hector Blanco white.li...@gmail.com: I'll give it a try!! Thank you! 2011/2/18

[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

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

2011-02-24 Thread Hector Blanco
:20 PM, Hector Blanco wrote: 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

[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 white.li...@gmail.com: Hello everyone! I have a class structure like this: class Store

[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 white.li...@gmail.com

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 mike...@zzzcomputing.com: 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):       Represents a user       __tablename__ = users       _id

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,

[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, String(50),

[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=set) (One

[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

[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

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 gbt...@gmail.com: 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

[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,

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
, 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. age...@themactionfaction.com: On Jan 21, 2011, at 12:29 PM, Hector Blanco wrote: Hello list! I have a couple of classes. One of the behaves as the container of the other

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

2011-01-20 Thread Hector Blanco
+1 2011/1/16 Jan Müller m...@dfi-net.de: +1 On Jan 15, 9:58 am, Eric Ongerth ericonge...@gmail.com wrote: +1 On Jan 13, 5:08 pm, rdlowrey rdlow...@gmail.com wrote: To Michael Bayer: sqlalchemy simplifies my life every day and makes me vastly more productive! Many thanks. --

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

2011-01-16 Thread Hector Blanco
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 mike...@zzzcomputing.com: On Jan 15, 2011, at 10:53 PM, Hector Blanco wrote: Hello list... I would like to allow the users

[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

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 problem is

[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 class

[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] 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 mike...@zzzcomputing.com: 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! I am facing a little

[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

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

2010-12-23 Thread Hector Blanco
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 test from Firefox and it breaks... 2010/12/23 Michael Bayer mike...@zzzcomputing.com: On Dec 23, 2010, at 2:09 PM, Hector Blanco wrote: Hello

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

2010-12-23 Thread Hector Blanco
the 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 method that grabs the user to: def getByName(userName

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 white.li...@gmail.com: Ok! I'll let you know... Thank you so much! It seems to fail less

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

2010-12-21 Thread Hector Blanco
, 2010, at 7:30 PM, Hector Blanco wrote: Hello all! I have an application running under Python2.6 and the classes are set up with properties (in a Python2.4 style, though). [ . . . ] So here's the question: Is there any way to get the properties of a class mapped

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

2010-12-21 Thread Hector Blanco
what I'm exactly touching here... (and how dangerous... or correct it may be) 2010/12/21 Hector Blanco white.li...@gmail.com: First of all, thank you for replying. I don't really know if I understood your idea. I dug a bit more in the User class (not the instance, but what it would be self

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

2010-12-21 Thread Hector Blanco
? 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 a field called descriptor which the InstrumentedAttribute don't have... so I can always do

[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:

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 laurent.rah...@gmail.com: Hello, You should also take a look at http://pypi.python.org/pypi/sqlamp/0.5.2, an implementation of

[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
! :) I'll keep you posted! 2010/11/13 jason kirtland j...@discorporate.us: Hi Hector, On Fri, Nov 12, 2010 at 7:46 AM, Hector Blanco white.li...@gmail.com wrote: Hello everyone. I was wondering if it's possible to inherit a custom collection to create another custom collection. A few days

[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

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
relationship on the opposite mapper. On Nov 12, 7:31 am, Hector Blanco white.li...@gmail.com wrote: 2010/11/12 Eric Ongerth ericonge...@gmail.com: Hi Hector, If I'm not mistaken, everywhere you wrote (MyObject.id==MyObject.containerId), you meant to write: (Container.id

[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 relationships:

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

2010-11-09 Thread Hector Blanco
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 you so much... 2010/11/9 Michael Bayer mike...@zzzcomputing.com: On Nov 8, 2010, at 6:36 PM, Hector

[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

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

2010-11-01 Thread Hector Blanco
this was SqlAlchemy fault, but more the megrok.rdb thing that I'm using, but well... Maybe this will help someone else. 2010/10/29 Conor conor.edward.da...@gmail.com: On 10/29/2010 05:31 PM, Hector Blanco wrote: Hello, group! I am still dealing with the relationship I asked before (http

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

2010-11-01 Thread Hector Blanco
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 conor.edward.da...@gmail.com: On 10/29/2010 11:51 AM, Hector Blanco wrote: Thanks Conor! The callable works like a charm! It's great news! (I've been

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 first,

[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

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

2010-10-30 Thread Hector Blanco
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 conor.edward.da...@gmail.com: On 10/29/2010 05:31 PM, Hector Blanco wrote: Hello, group! I am still dealing

[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):

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

2010-10-29 Thread Hector Blanco
to the parent. I'd like to know what people that know much more about databases think :) 2010/10/29 Conor conor.edward.da...@gmail.com: On 10/29/2010 09:43 AM, Hector Blanco wrote: Hello list... I wrote a couple of days ago about how to model an structure of three classes (http

[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

[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

[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 white.li...@gmail.com Hello everyone. First of all, thank you for reading

[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 =

[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