[sqlalchemy] Adjacency List tree - inefficient reading

2009-01-18 Thread Kless

SQA recommends the adjacency list pattern [1] over another patterns:

Despite what many online articles say about modified preorder, the
adjacency list model is probably the most appropriate pattern for the
large majority of hierarchical storage needs, for reasons of
concurrency, reduced complexity, and that modified preorder has little
advantage over an application which can fully load subtrees into the
application space.

But should be in mind that it's slow in reads (althought it's fast in
writes). In change, the nested sets have very efficient reads at the
cost of high maintenance on write/delete operations.

If any is interested in tree structures, there is an excelent
implementation for django ORM, django-treebeard [2], which has
included any benchmarks where you can see the reading differences
between different structures.


[1] http://www.sqlalchemy.org/docs/05/mappers.html#adjacency-list-relationships
[2] http://code.google.com/p/django-treebeard/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Adjacency List tree - inefficient reading

2009-01-18 Thread Kless

The author of django-treebeard created the ns-tree implementation
based on Joe Celko as SQAlchemy's [1].

Here is its implementation [2]. I hope that helps.


[1] 
http://www.sqlalchemy.org/trac/browser/sqlalchemy/trunk/examples/nested_sets/nested_sets.py
[2] 
http://code.google.com/p/django-treebeard/source/browse/trunk/treebeard/ns_tree.py

On 18 ene, 18:47, Michael Bayer mike...@zzzcomputing.com wrote:
 We have a proof of concept for nested sets in the /examples folder.

 However what I cant figure out with nested sets is, how do I load only  
 the immediate children of a node ?    That is the most common accessor  
 I'd like on a self referential node and I'm not aware of how to do  
 it.   It makes it sort of impossible for there to be a .children  
 accessor on a node, unless you load the full subtree and organize.

 On Jan 18, 2009, at 1:33 PM, Kless wrote:



  SQA recommends the adjacency list pattern [1] over another patterns:

  Despite what many online articles say about modified preorder, the
  adjacency list model is probably the most appropriate pattern for the
  large majority of hierarchical storage needs, for reasons of
  concurrency, reduced complexity, and that modified preorder has little
  advantage over an application which can fully load subtrees into the
  application space.

  But should be in mind that it's slow in reads (althought it's fast in
  writes). In change, the nested sets have very efficient reads at the
  cost of high maintenance on write/delete operations.

  If any is interested in tree structures, there is an excelent
  implementation for django ORM, django-treebeard [2], which has
  included any benchmarks where you can see the reading differences
  between different structures.

  [1]http://www.sqlalchemy.org/docs/05/mappers.html#adjacency-list-relatio...
  [2]http://code.google.com/p/django-treebeard/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Creating a custom type

2009-01-01 Thread Kless

I've been trying create the extension. Here is the code with a test:

  http://paste.pocoo.org/show/97502/ - Extension
  http://paste.pocoo.org/show/97503/ - Test

I need help to solve this little issue:

entity._descriptor.add_mapper_extension(BcryptMapperExtension())
AttributeError: 'str' object has no attribute '_descriptor'

Does could review the extension code?


On 22 dic 2008, 03:40, Michael Bayer mike...@zzzcomputing.com wrote:
 oh, yeah for that recipe you'd have to use a flag on the mapper()  
 called batch=False.    But don't use that, its inefficient.

 So you can also create your type to detect a special value from the  
 mapper extension:

 def before_insert(self, ):
         instance.password = (instance.password, True)

 class MyType(...):
         ...

         def process_bind_param(self, value, dialect):
                 if isinstance(value, tuple):
                         return hasher.create(value[0], value[1])
                 

 But since this is really an instance-level business rule, a straight  
 descriptor and no custom type is definitely how I'd go on this one.

 On Dec 21, 2008, at 6:47 PM, Kless wrote:



  Thank you for detailed answer.

  Here are any thoughts:

  1) The before_insert was being omitted while I was inserting records
  using an insert statement --that's logical because it was bypassing
  the ORM--.

  2) It's necessary to use *session.commit()* after of each record
  because else it will have the value of 'instance.admin' of the last
  record which will be used for all records to commit.

  3) I believe that it isn't necessary use *after_insert*.

  On 21 dic, 17:00, Michael Bayer mike...@zzzcomputing.com wrote:
  On Dec 21, 2008, at 6:53 AM, Kless wrote:
  I'm trying to build a custom type [1] to manage the bcrypt hashes  
  [2].

  ---
  from bcrypt_wrap import password
  from sqlalchemy import types

  class Bcrypt(types.TypeDecorator):
   Stores a bcrypt hash of a password.
   impl = types.String #(60)
   hasher = password.Password()

   def process_bind_param(self, value, dialect):
     return hasher.create(value)
  ---

  And I've any doubts:

  1) Since that the hash length is always 60, is there that use the
  next?
   impl = types.String(60)

  2) The bcryptWrap API [3] (line 53) lets call to 'create' with
  arguments 'cost' and 'admin' (boolean). Then,

   a) I would that the cost could be passed from the column  
  definition,
  i.e.
       password = sqlalchemy.Column(types.Bcrypt, cost=12)
  or
       password = sqlalchemy.Column(types.Bcrypt(cost=12))

   b) This would be more hard, but I would to pass the 'admin'  
  argument
  when an object is created

     u = model.User()
     u.login = u'foo'
     u.password = u'bar'
     u.admin = True

     And sou could be call:
         return hasher.create(value, admin=True)

  the TypeDecorator's __init__ method just calls the impl class
  immediately, so the best approach is like:

  class Bcrypt(types.TypeDecorator):
       Stores a bcrypt hash of a password.
       impl = types.String
       hasher = password.Password()

       def __init__(self, cost):
           self.cost = cost
           types.TypeDecorator.__init__(self, 60)

       def process_bind_param(self, value, dialect):
           return hasher.create(value)

  then you can instantate like:

  Column('foo', Bcrypt(cost=12))

  For b, the type object and the ExecutionContext which ultimately  
  calls
  its process_bind_param method are unaware of the ORM or the ORM-
  specific context in which its called during INSERT/UPDATE.   If you
  wanted to keep the logic within your type like that you'd have to
  integrate to a thread-local variable that is configured within an ORM
  plugin, something like:

  hasher_status = threading.local()

  class MyMapperExt(MapperExtension):
       def before_insert(self, ...):
           hasher_status.admin = instance.admin

       def after_insert(self, ...)
           del hasher_status.admin

  mapper(MyClass, table, ext=MyMapperExt)

  class Bcrypt(types.TypeDecorator):
       ...

       def process_bind_param(self, value, dialect):
           return hasher.create(value, getattr(hasher_status, 'admin',
  False))

  Alternatively, you could keep the logic within the ORM using either a
  valdiator or a descriptor, as described 
  athttp://www.sqlalchemy.org/docs/05/mappers.html#changing-attribute-beh
  ...
    .  It depends on if you'd like your Bcrypt type to work with direct
  SQL expression language use or not.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] LucidDB - open RDBMS with advanced features

2009-01-01 Thread Kless

Here there is a presentation [1] over LucidDB [2], a new open-source
RDBMS with advanced features and greater performance than MySQL.

Besides column-store, other features covered include bitmap indexing,
hash join/aggregation, page-level multiversioning, intelligent
prefetch, star-join optimization, connectivity, and extensibility.


[1] http://en.oreilly.com/oscon2008/public/schedule/detail/2781
[2] http://www.luciddb.org/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Creating a custom type

2009-01-01 Thread Kless

It's being passed from the IsBcrypt constructor, so:

  entity._descriptor.add_mapper_extension(BcryptMapperExtension())


On 1 ene, 19:48, Michael Bayer mike...@zzzcomputing.com wrote:
 mapper extensions are established during the mapper() phase:

 mapper(someclass, sometable, extension=BycryptMapperExtension())

 On Jan 1, 2009, at 1:35 PM, Kless wrote:
  I've been trying create the extension. Here is the code with a test:

   http://paste.pocoo.org/show/97502/- Extension
   http://paste.pocoo.org/show/97503/- Test

  I need help to solve this little issue:

  entity._descriptor.add_mapper_extension(BcryptMapperExtension())
  AttributeError: 'str' object has no attribute '_descriptor'

  Does anybody could review the extension code?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Creating a custom type

2009-01-01 Thread Kless

I just see that will be by a problem of change in API

AttributeError: 'str' object has no attribute '_descriptor'

Kless ha escrito:
 It's being passed from the IsBcrypt constructor, so:

   entity._descriptor.add_mapper_extension(BcryptMapperExtension())


 On 1 ene, 19:48, Michael Bayer mike...@zzzcomputing.com wrote:
  mapper extensions are established during the mapper() phase:
 
  mapper(someclass, sometable, extension=BycryptMapperExtension())
 
  On Jan 1, 2009, at 1:35 PM, Kless wrote:
   I've been trying create the extension. Here is the code with a test:
 
   �http://paste.pocoo.org/show/97502/- Extension
   �http://paste.pocoo.org/show/97503/- Test
 
   I need help to solve this little issue:
 
   entity._descriptor.add_mapper_extension(BcryptMapperExtension())
   AttributeError: 'str' object has no attribute '_descriptor'
 
   Does anybody could review the extension code?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Creating a custom type

2009-01-01 Thread Kless

Thanks. This was your message on the Elixir list:

It looks to me like you are using SQLAlchemy without Elixir, and
therefore this isn't the proper place to be asking this question. You
should ask over on the SQLAlchemy mailing list.

If you would like help creating an elixir extension, I can help you
with that here.

Good luck.

On 1 ene, 21:01, Jonathan LaCour jonathan-li...@cleverdevil.org
wrote:
 Kless wrote:
  I just see that will be by a problem of change in API

  AttributeError: 'str' object has no attribute '_descriptor'

 As I indicated to you over on the Elixir list, you seem to have
 used the Elixir encryption extension as a starting point. The
 _descriptor and the concept of an entity are Elixir concepts,
 not SQLAlchemy concepts. You need to base your work on other mapper
 extensions, not on the Elixir extension, which is designed to only
 work with Elixir models, not plain-SQLAlchemy models.

 I'd suggest starting over, and using the following documentation
 references:

 Mapper Extension API reference:http://tinyurl.com/8wfkgl
 Applying Mapper Extensions:http://tinyurl.com/7a3b5c

 Good luck.

 --
 Jonathan LaCourhttp://cleverdevil.org
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Get value for each instance

2008-12-24 Thread Kless

How to get the value for a column for each instance --from a
descriptor--?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Get value for each instance

2008-12-24 Thread Kless

Well, at the end I found a post that could be the solution:

http://beachcoder.wordpress.com/2007/05/02/adding-event-callbacks-to-sqlalchemyelixir-classes/

On 24 dic, 15:48, Kless jonas@googlemail.com wrote:
 How to get the value for a column for each instance --from a
 descriptor--?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Creating a custom type

2008-12-22 Thread Kless

Thank you. Your aid is incalculable as always.
I'll use a descriptor for this case as you well advise.

On 22 dic, 03:40, Michael Bayer mike...@zzzcomputing.com wrote:
 oh, yeah for that recipe you'd have to use a flag on the mapper()  
 called batch=False.    But don't use that, its inefficient.

 So you can also create your type to detect a special value from the  
 mapper extension:

 def before_insert(self, ):
         instance.password = (instance.password, True)

 class MyType(...):
         ...

         def process_bind_param(self, value, dialect):
                 if isinstance(value, tuple):
                         return hasher.create(value[0], value[1])
                 

 But since this is really an instance-level business rule, a straight  
 descriptor and no custom type is definitely how I'd go on this one.

 On Dec 21, 2008, at 6:47 PM, Kless wrote:
  2) It's necessary to use *session.commit()* after of each record
  because else it will have the value of 'instance.admin' of the last
  record which will be used for all records to commit.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Creating a custom type

2008-12-22 Thread Kless

Although it's necessary to consider that continues being necessary a
custom type to add a new argument (in this case is 'cost'). And I
prefer a custom type before that a subclass of Column for this one.

Now well, to get the another argument which is at instance-level
surely will be better make it thorught a descriptor, as you said.

On 22 dic, 09:37, Kless jonas@googlemail.com wrote:
 Thank you. Your aid is incalculable as always.
 I'll use a descriptor for this case as you well advise.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Creating a custom type

2008-12-21 Thread Kless

I'm trying to build a custom type [1] to manage the bcrypt hashes [2].

---
from bcrypt_wrap import password
from sqlalchemy import types


class Bcrypt(types.TypeDecorator):
  Stores a bcrypt hash of a password.
  impl = types.String #(60)
  hasher = password.Password()

  def process_bind_param(self, value, dialect):
return hasher.create(value)
---

And I've any doubts:

1) Since that the hash length is always 60, is there that use the
next?
  impl = types.String(60)

2) The bcryptWrap API [3] (line 53) lets call to 'create' with
arguments 'cost' and 'admin' (boolean). Then,

  a) I would that the cost could be passed from the column definition,
i.e.
  password = sqlalchemy.Column(types.Bcrypt, cost=12)
or
  password = sqlalchemy.Column(types.Bcrypt(cost=12))

  b) This would be more hard, but I would to pass the 'admin' argument
when an object is created

u = model.User()
u.login = u'foo'
u.password = u'bar'
u.admin = True

And sou could be call:
return hasher.create(value, admin=True)


[1] 
http://www.sqlalchemy.org/docs/05/reference/sqlalchemy/types.html#custom-types

[2] http://pypi.python.org/pypi/bcryptWrap/

[3] http://www.bitbucket.org/ares/bcryptwrap/src/tip/lib/bcrypt_wrap/password.py

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Creating a custom type

2008-12-21 Thread Kless

Thank you for detailed answer.

Here are any thoughts:

1) The before_insert was being omitted while I was inserting records
using an insert statement --that's logical because it was bypassing
the ORM--.

2) It's necessary to use *session.commit()* after of each record
because else it will have the value of 'instance.admin' of the last
record which will be used for all records to commit.

3) I believe that it isn't necessary use *after_insert*.


On 21 dic, 17:00, Michael Bayer mike...@zzzcomputing.com wrote:
 On Dec 21, 2008, at 6:53 AM, Kless wrote:
  I'm trying to build a custom type [1] to manage the bcrypt hashes [2].

  ---
  from bcrypt_wrap import password
  from sqlalchemy import types

  class Bcrypt(types.TypeDecorator):
   Stores a bcrypt hash of a password.
   impl = types.String #(60)
   hasher = password.Password()

   def process_bind_param(self, value, dialect):
     return hasher.create(value)
  ---

  And I've any doubts:

  1) Since that the hash length is always 60, is there that use the
  next?
   impl = types.String(60)

  2) The bcryptWrap API [3] (line 53) lets call to 'create' with
  arguments 'cost' and 'admin' (boolean). Then,

   a) I would that the cost could be passed from the column definition,
  i.e.
       password = sqlalchemy.Column(types.Bcrypt, cost=12)
  or
       password = sqlalchemy.Column(types.Bcrypt(cost=12))

   b) This would be more hard, but I would to pass the 'admin' argument
  when an object is created

     u = model.User()
     u.login = u'foo'
     u.password = u'bar'
     u.admin = True

     And sou could be call:
         return hasher.create(value, admin=True)

 the TypeDecorator's __init__ method just calls the impl class  
 immediately, so the best approach is like:

 class Bcrypt(types.TypeDecorator):
      Stores a bcrypt hash of a password.
      impl = types.String
      hasher = password.Password()

      def __init__(self, cost):
          self.cost = cost
          types.TypeDecorator.__init__(self, 60)

      def process_bind_param(self, value, dialect):
          return hasher.create(value)

 then you can instantate like:

 Column('foo', Bcrypt(cost=12))

 For b, the type object and the ExecutionContext which ultimately calls  
 its process_bind_param method are unaware of the ORM or the ORM-
 specific context in which its called during INSERT/UPDATE.   If you  
 wanted to keep the logic within your type like that you'd have to  
 integrate to a thread-local variable that is configured within an ORM  
 plugin, something like:

 hasher_status = threading.local()

 class MyMapperExt(MapperExtension):
      def before_insert(self, ...):
          hasher_status.admin = instance.admin

      def after_insert(self, ...)
          del hasher_status.admin

 mapper(MyClass, table, ext=MyMapperExt)

 class Bcrypt(types.TypeDecorator):
      ...

      def process_bind_param(self, value, dialect):
          return hasher.create(value, getattr(hasher_status, 'admin',  
 False))

 Alternatively, you could keep the logic within the ORM using either a  
 valdiator or a descriptor, as described 
 athttp://www.sqlalchemy.org/docs/05/mappers.html#changing-attribute-beh...
   .  It depends on if you'd like your Bcrypt type to work with direct  
 SQL expression language use or not.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: New plugins and data types

2008-12-08 Thread Kless

Thanks! Anyway I've seen that it's better add extensions in Elixir,
into a declarative layer, just as has been made in DataMapper.

http://elixir.ematia.de/apidocs/elixir.ext.html

On 7 dic, 14:54, Michael Bayer [EMAIL PROTECTED] wrote:
 we have a bitbucket mirror athttp://www.bitbucket.org/mirror/sqlalchemy/

 On Dec 7, 2008, at 5:01 AM, Kless wrote:



  I agree in that the SQLalchemy core been more centralized but would be
  very well if there would be a distributed version control where can be
  added easily new types.

  See as example to dm-more [1] -- of Datamapper--, where there are many
  contributions and many of them are very interesting.

  [1]http://github.com/sam/dm-more/tree/master/dm-types/lib/dm-types
 http://github.com/sam/dm-more/tree/master
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] New plugins and data types

2008-12-07 Thread Kless

I agree in that the SQLalchemy core been more centralized but would be
very well if there would be a distributed version control where can be
added easily new types.

See as example to dm-more [1] -- of Datamapper--, where there are many
contributions and many of them are very interesting.


[1] http://github.com/sam/dm-more/tree/master/dm-types/lib/dm-types
http://github.com/sam/dm-more/tree/master

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Little Bug - orm.object_mapper.get_property

2008-07-14 Thread Kless

I refer to the docstring and this is my version: SQLAlchemy-0.5.0beta1-
py2.5.egg

On Jul 14, 1:59 am, Michael Bayer [EMAIL PROTECTED] wrote:
 On Jul 13, 2008, at 1:38 PM, Kless wrote:



  *orm.object_mapper* has an argument called 'raiseerror', and it works
  ok.

  *orm.object_mapper.get_property* also has an argument called
  'raiseerror' (that says on documentation), but it fails: *unexpected
  keyword argument 'raiseerror'*. It's using as argument: 'raiseerr'.

 I dont like those raiseerror flags very much and in reality I'd like  
 to take them out.  Although I am not seeing the get_property()  
 documentation you're referring to, in both 0.4 and 0.5 the  docstring  
 does not describe the arguments for that method.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Little Bug - orm.object_mapper.get_property [Wrong]

2008-07-14 Thread Kless

Sorry! I suppose that I was confused.

On Jul 14, 8:34 pm, Michael Bayer [EMAIL PROTECTED] wrote:
 not seeing it:

 # pydoc sqlalchemy.orm.mapperlib.Mapper.get_property

 Help on method get_property in sqlalchemy.orm.mapperlib.Mapper:

 sqlalchemy.orm.mapperlib.Mapper.get_property = get_property(self, key,  
 resolve_synonyms=False, raiseerr=True) unbound
   sqlalchemy.orm.mapper.Mapper method
      return a MapperProperty associated with the given key.

 On Jul 14, 2008, at 3:45 AM, Kless wrote:



  I refer to the docstring and this is my version:  
  SQLAlchemy-0.5.0beta1-
  py2.5.egg

  On Jul 14, 1:59 am, Michael Bayer [EMAIL PROTECTED] wrote:
  On Jul 13, 2008, at 1:38 PM, Kless wrote:

  *orm.object_mapper* has an argument called 'raiseerror', and it  
  works
  ok.

  *orm.object_mapper.get_property* also has an argument called
  'raiseerror' (that says on documentation), but it fails: *unexpected
  keyword argument 'raiseerror'*. It's using as argument: 'raiseerr'.

  I dont like those raiseerror flags very much and in reality I'd  
  like
  to take them out.  Although I am not seeing the get_property()
  documentation you're referring to, in both 0.4 and 0.5 the  docstring
  does not describe the arguments for that method.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: problem with server_default (and/or sa.PassiveDefault in 0.5.beta1

2008-07-13 Thread Kless

It fails with fields of date. It shows:

created_at=*datetime.datetime(2008, 7, 13, 13, 59, 57)*

On Jun 21, 7:25 pm, Michael Bayer [EMAIL PROTECTED] wrote:
 that __repr__ is pretty tortured too; a typical ORM-agnostic approach  
 is:

      def __repr__(self):
              return %s(%s) % (
                  (self.__class__.__name__),
                  ', '.join([%s=%r % (key, getattr(self, key))
                             for key in sorted(self.__dict__.keys())
                             if not key.startswith('_')]))
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Column class with NULL=False

2008-07-12 Thread Kless

Michael, why don't change the 'Column' class values to *nullable =
False, default=''* ?

After of reading the down articles I think that set NULL to False by
default will avoid possible errors to many people.

NULL means something is unknown. [1]

NULL needs to be used with prudence and with care. Just because the
database supports the use of NULL doesn’t mean that you should design
for NULL. Rather, a good design will prevent the overuse of  NULL.
Although I said that a good implementation will prevent uncertainty of
NULL, it is important to note that NULL can be ambiguous and cause
uncertainty if used improperly. [2]

It looks enought logical the Django's position respect to NULL [3]:

Default is False.

Note that empty string values will always get stored as empty strings,
not as NULL. Only use null=True for non-string fields such as
integers, booleans and dates.

Avoid using null on string-based fields unless you have an excellent
reason. If a string-based field has null=True, that means it has two
possible values for “no data”: NULL, and the empty string. In most
cases, it’s redundant to have two possible


[1] http://www.databasedesign-resource.com/null-values-in-a-database.html

[2] http://sqlfight.com/blogs/mystery_blogger/pages/is-null-so-bad.aspx

[3] http://www.djangoproject.com/documentation/model-api/#null

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Column class with NULL=False

2008-07-12 Thread Kless

Well, the programs has backward incompatibility prior version 1.0

On Jul 12, 5:46 pm, Rick Morrison [EMAIL PROTECTED] wrote:
 This would be very ugly for backward compatibility. If you want non-null,
 then just say so in your metadata. Jamming relational design dogma down
 everyone's throat is not a great recipe for library uptake.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: nullable=False by default

2008-07-07 Thread Kless

But I'm supposed that the generation function of autoincrement only
works when the field is NULL or there is an integer, so this fails on
fields with a string empty.

On Jul 7, 8:06 am, Kless [EMAIL PROTECTED] wrote:
 Yes, I read it. The integer columns with the primary key flag set
 are not being autoincremented, after of the Column subclass.

 On Jul 7, 3:45 am, Michael Bayer [EMAIL PROTECTED] wrote:

  On Jul 6, 2008, at 7:06 PM, Kless wrote:

   I think that there is a bug.

   autoincrement doesn't works with *default=''*

   Any solution to this problem?

  the docs for autoincrement need to be read closely.  This flag only  
  applies to Integer columns with the primary key flag set.  I'm not  
  sure what interaction it would be expected to have with default in  
  any case (default is all you need if you have a custom default  
  generation function).
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: nullable=False by default

2008-07-07 Thread Kless

Yes, it's SQLite. I use it into the development.

On Jul 7, 4:06 pm, Michael Bayer [EMAIL PROTECTED] wrote:
 On Jul 7, 2008, at 3:10 AM, Kless wrote:



  But I'm supposed that the generation function of autoincrement only
  works when the field is NULL or there is an integer, so this fails on
  fields with a string empty.

 im not sure offhand what an empty string would produce since I'd have  
 to check what we're doing to detect no value present.   But I would  
 hope that if the string value went through, it would raise an error on  
 the DB side (so this impies you might be using SQLite).
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: nullable=False by default

2008-07-07 Thread Kless

You have reason. I checked it with MySQL and it works ok.
So here I have a lesson learned: use the same RDBMS on developing.

Thanks Michael.

On Jul 7, 4:50 pm, Michael Bayer [EMAIL PROTECTED] wrote:
 then its probably inserting your blank string into the column.  SQLA  
 doesn't want to get too much in the way of the natural features of  
 the database in use.

 On Jul 7, 2008, at 11:09 AM, Kless wrote:



  Yes, it's SQLite. I use it into the development.

  On Jul 7, 4:06 pm, Michael Bayer [EMAIL PROTECTED] wrote:
  On Jul 7, 2008, at 3:10 AM, Kless wrote:

  But I'm supposed that the generation function of autoincrement only
  works when the field is NULL or there is an integer, so this fails  
  on
  fields with a string empty.

  im not sure offhand what an empty string would produce since I'd have
  to check what we're doing to detect no value present.   But I would
  hope that if the string value went through, it would raise an error  
  on
  the DB side (so this impies you might be using SQLite).
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] nullable=False by default

2008-07-06 Thread Kless

Is possible create the fields with nullable=False by default?

It's heavy to have to add this to each field.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: nullable=False by default

2008-07-06 Thread Kless

And, why can I add 'default'
--
def Column0(*a, **k):
return Column(nullable=False, default='', *a, **k)
--
it shows the next error:

TypeError: _FigureVisitName object got multiple values for keyword
argument 'default'

On Jul 6, 7:53 pm, [EMAIL PROTECTED] wrote:
 u can workaround by
 def Column0( *a,**k): return Column( nullable=False, *a,**k)
 and use Column0(...) instead of Column...

 On Sunday 06 July 2008 21:53:52 Kless wrote:

  Is possible create the fields with nullable=False by default?

  It's heavy to have to add this to each field.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: nullable=False by default

2008-07-06 Thread Kless

I'm using so:

def Column0(*a, **k):
return Column(nullable=False, default='', *a, **k)

groups_table = Table('foo', metadata,
Column0('id', Integer, primary_key=True),
Column0('bar', Unicode(16)),
)

Note: I'm using SA 0.5 beta.

But well, that solved it. Thank you very much.


On Jul 6, 9:17 pm, [EMAIL PROTECTED] wrote:
 how are u using it? probably u have another default=?
 or there is a non-keyword/positional argument matching that...

 try something like:
  def Column0(*a, **k):
      k.setdefault('default', '')        
      k.setdefault('nullable', False)    
      return Column(*a, **k)
 thus if u dont specify it explicit, it'll be implicit there.

  And, why can I add 'default'
  --
  def Column0(*a, **k):
      return Column(nullable=False, default='', *a, **k)
  --
  it shows the next error:

  TypeError: _FigureVisitName object got multiple values for keyword
  argument 'default'
  On Jul 6, 7:53 pm, [EMAIL PROTECTED] wrote:
   u can workaround by
   def Column0( *a,**k): return Column( nullable=False, *a,**k)
   and use Column0(...) instead of Column...

   On Sunday 06 July 2008 21:53:52 Kless wrote:
Is possible create the fields with nullable=False by default?

It's heavy to have to add this to each field.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: nullable=False by default

2008-07-06 Thread Kless

I think that there is a bug.

autoincrement doesn't works with *default=''*

Any solution to this problem?

On Jul 6, 10:46 pm, Kless [EMAIL PROTECTED] wrote:
 I'm using so:
 
 def Column0(*a, **k):
     return Column(nullable=False, default='', *a, **k)

 groups_table = Table('foo', metadata,
     Column0('id', Integer, primary_key=True),
     Column0('bar', Unicode(16)),
 )
 
 Note: I'm using SA 0.5 beta.

 But well, that solved it. Thank you very much.

 On Jul 6, 9:17 pm, [EMAIL PROTECTED] wrote:

  how are u using it? probably u have another default=?
  or there is a non-keyword/positional argument matching that...

  try something like:
   def Column0(*a, **k):
       k.setdefault('default', '')        
       k.setdefault('nullable', False)    
       return Column(*a, **k)
  thus if u dont specify it explicit, it'll be implicit there.

   And, why can I add 'default'
   --
   def Column0(*a, **k):
       return Column(nullable=False, default='', *a, **k)
   --
   it shows the next error:

   TypeError: _FigureVisitName object got multiple values for keyword
   argument 'default'
   On Jul 6, 7:53 pm, [EMAIL PROTECTED] wrote:
u can workaround by
def Column0( *a,**k): return Column( nullable=False, *a,**k)
and use Column0(...) instead of Column...

On Sunday 06 July 2008 21:53:52 Kless wrote:
 Is possible create the fields with nullable=False by default?

 It's heavy to have to add this to each field.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] _is_oid

2008-07-06 Thread Kless

Does anybody could say anything more?

Defaults to False: used internally to indicate that this column is
used as the quasi-hidden oid column

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Fill automatically one column

2008-05-25 Thread Kless

One column could be filled automatically with the value of another 2
columns? If it's possible, how do it?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] New data types for PostgreSQL 8.3

2008-05-25 Thread Kless

PostgreSQL 8.3 has any new data types very interesting as enumerated
(ENUM) [1],  XML [2], Universally Unique Identifiers (UUID) [3].
Another interesting data type would be the monetary type [4].

It would very interesting that could be used from SQLAlchemy.


[1] http://www.postgresql.org/docs/8.3/static/datatype-enum.html
[2] http://www.postgresql.org/docs/8.3/static/datatype-xml.html
[3] http://www.postgresql.org/docs/8.3/static/datatype-uuid.html
[4] http://www.postgresql.org/docs/8.3/static/datatype-money.html

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] [Solved] Fill automatically one column

2008-05-25 Thread Kless

This is made from constructor --the __init__ method--.

On 25 mayo, 11:54, Kless [EMAIL PROTECTED] wrote:
 One column could be filled automatically with the value of another 2
 columns? If it's possible, how do it?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---