On 2018-01-31 13:50, Raimon Esteve wrote:
> I try with python-sql to update a column to "null".
>
> Somebody know how to update to null a column?
>
> Example:
>
> query = user.update(
> columns=[user.main_company],
> values=[None], <- I like here to update with null
> where=user.main_company != Null)
As you do not explain what is not working, we can not help you.
2018-01-31 15:19 GMT+01:00 Cédric Krier <cedric...@b2ck.com>:On 2018-01-31 13:50, Raimon Esteve wrote:
> I try with python-sql to update a column to "null".
>
> Somebody know how to update to null a column?
>
> Example:
>
> query = user.update(
> columns=[user.main_company],
> values=[None], <- I like here to update with null
> where=user.main_company != Null)
As you do not explain what is not working, we can not help you.Examples and errors with python-sql 0.9:1- values is [None]query = user.update(columns=[user.main_company],values=[None],where=user.main_company != Null)Query is:('UPDATE "res_user" SET "main_company" = %s WHERE ("res_user"."main_company" IS NOT NULL)', (None,))
Get error:File "/home/resteve/.virtualenvs/nan40/local/lib/python2.7/site-packages/sql/__init__.py", line 193, in __iter__yield str(self)File "/home/resteve/.virtualenvs/nan40/local/lib/python2.7/site-packages/sql/__init__.py", line 766, in __str__where = ' WHERE ' + str(self.where)File "/home/resteve/.virtualenvs/nan40/local/lib/python2.7/site-packages/sql/operators.py", line 224, in __str__return '(%s IS NOT NULL)' % self.leftFile "/home/resteve/.virtualenvs/nan40/local/lib/python2.7/site-packages/sql/__init__.py", line 1300, in __str__alias = self._from.aliasFile "/home/resteve/.virtualenvs/nan40/local/lib/python2.7/site-packages/sql/__init__.py", line 250, in aliasreturn AliasManager.get(self)File "/home/resteve/.virtualenvs/nan40/local/lib/python2.7/site-packages/sql/__init__.py", line 155, in getif getattr(cls.local, 'alias', None) is None:RuntimeError: maximum recursion depth exceeded in cmp