
Hi all,
I am trying to select specific columns from a MySQL table into csv.
This table can have NULL or blank values and I want to differentiate between two when I extract.
Right now what's happening is that the extract has blank values for both NULL and blank values.
Is there any recommended way to do this?
The above is printing both blank and NULL values same: blank
File produced is this way, no diff between the NULL and Blanks values:
|2020-09-18 02:48:04|||||||||
I am trying to select specific columns from a MySQL table into csv.
This table can have NULL or blank values and I want to differentiate between two when I extract.
Right now what's happening is that the extract has blank values for both NULL and blank values.
Is there any recommended way to do this?
import mysql.connector mydb = mysql.connector.connect( host="host", user="user", password="pwd", ) mycursor = mydb.cursor() mycursor.execute("select * from db_name.table_name") myresult = mycursor.fetchall() for x in myresult: print(x)Somehow formatting is not working for me so can't conver code into code snippet or insert images but trying my best.
The above is printing both blank and NULL values same: blank
File produced is this way, no diff between the NULL and Blanks values:
|2020-09-18 02:48:04|||||||||