How to handle Sybase table with null value in Python
create table Account(
accountId varchar(12) not null,
rollup_indicator char(1) null
)
when need to insert one row as ('038C08234', null) (roolliup_indicator has null value)
sql= "insert into Account(accountId, rollup_indicator) values(?, ?) "
in Python, when detect a value is None, we can't pass None to the sql statement, and there is no NULL variable, if pass 'NULL' string as rollup_indicator value, the insert will not take effect, since rollup_indicator is char(1), 'NULL' is 4 characters.
I am using sybpydb module and execute with cursor
cur.executor(sql, ('038C08234', 'NULL'))
Anyone has experienced with inserting/updating null value in Python Sybase? Thanks,
Bill
Hello @William Wang
Welcome to the Atlassian community.
This specific forum is a location for questions concerning the Confluence product from Atlassian.
Can you clarify how your question relates to the Confluence product?
Assuming the answer is that your question does not relate to Confluence, you may want to look elsewhere for assistance.
For instance, I used Google to search for insert null value in sybase with python and got several answers in the results which might prove useful (if I was familiar with sybase).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.