I am using the sqlite3 in python.
I've created a table in the database. The table has some NULL values
import sqlite3
engine = sqlite3.connect('Practice')
BST = pd.DataFrame({'N':[1,3,5,7,2,6,4,8,10,12,14,9,13,11,15],'P':[2,2,6,6,4,4,15,9,9,13,13,11,11,15,'NULL']})
BST.to_sql(name = "BST", con=engine, if_exists = 'replace', index = False)
Then I want to create a view of this table
pd.read_sql_query("CREATE VIEW V1 as select P from BST",con=engine)
But it throws an error TypeError: 'NoneType' object is not iterable.
I wonder how should I create a view of a table in sqlite when the table contains NULL value?
df.to_sql()is a pandas function so as to either create a real table in the database or create a view (which occupies less memory than create an actual table?) in the database that can be refer to later, am I right?pd.read_sql_query()is really just read the sql query and fetch the rows, columns in the created table (or view) in the database?engine.executeto create that viewV1....