Hello Guys,

I was having issues cause some empty arguments were treated as "" (emtpy) 
instead of none, so the filter() was translating the query as 'where 
column=""' instead of "where column is NULL", so I'm trying to write some 
validation in my add method in my classes:

class Someclass(Object): 

   add(self, **kwargs)
      tbl = self.__tablename__
      for key in table.c.keys():
         if key not in kwargs:
            kwargs.setdefault(key, None)
          
         value = kwargs.get(key)
         if not value:
            kwargs[key] = None

mapper(Someclass, any_table)

Is that possible? if so, can a parent class be written in that way so child 
classes will include this validation of the argument based on the table 
columns as part of the add method?
Sorry for the questions but I'm new on both worlds (Python and SQLAlchemy)

Thanks and kind regards

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to