Title: SQLite3 Python: Data type TEXT if null 'N/A'
Tags: python;sqlite;default-value
Question: I would like to know if there is a way of setting a default for the data types.
For example the INTEGER PRIMARY KEY will auto increment or how the NOT NULL, wont allow None. What I would like to have happen, would be that when a None type
is entered into a TEXT column it will input 'N/A' instead of entering nothing. Is this possible or would I have to write a method that would do this?

Here is the accepted answer: Just define the column to have a DEFAULT:
CREATE TABLE FOO (
BAR TEXT DEFAULT "N/A"
See the SQLite TABLE documentation.
Comment for this answer: The default is used if you *omit* the column on an insert.
Comment for this answer: When I input a `None` or `Null` It still inputs a `None` type, not 'N/A'


{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2013:00:01/03/13', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<python><sqlite><default-value>', 'Title': "SQLite3 Python: Data type TEXT if null 'N/A'", 'ViewCount': 231, 'id': 14143619, 'user_AboutMe': '', 'user_AccountId': 1449913.0, 'user_DisplayName': 'Brandon Nadeau', 'user_Reputation': 3358.0, 'user_Views': 283.0, 'user_id': 1367160.0}}