pythonsqlalchemy

How to insert NULL value in SQLAlchemy?


I've a Table with the following column:

Column('type', String(128))

How do I set this column to NULL when inserting a new row in database?

I tried doing this:

self.type = NULL;

There is no NULL type in Python so I don't know how to do it.


Solution

  • Instead of trying

    self.type = NULL
    

    try as Yaroslav Admin suggested

    self.type = None
    

    As Python's equivalent for NULL is None.