, 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__
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 =
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):
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
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
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
, 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
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,
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
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
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
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
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
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
@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
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:
--
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):
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
(), 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
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
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
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):
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
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
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
. 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
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 =
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
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
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
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
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
)
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
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):
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
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
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
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
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
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
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
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
: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
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
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
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
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,
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),
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
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
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
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
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,
, 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
+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.
--
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
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
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
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
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:
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
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
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
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
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
, 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
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
?
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
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:
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
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()
! :) 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
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
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
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:
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
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
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
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
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,
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
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
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):
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
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
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
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
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
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 =
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
90 matches
Mail list logo