I need to import a csv file into a database in order to query it in a Python notebook and I tried several commands but every time I get a syntax error. I created a new empty database using
conn_british = sqlite3.connect('path\db name')
This is the code I tried
query='''BULK INSERT
{table_name}
FROM '\Documents\file.csv'
[WITH
(
[FORMAT = 'CSV'],
[FIELDQUOTE = '"'],
[FIRSTROW = 2],
[FIELDTERMINATOR = ','],
[ROWTERMINATOR = '\n'],
[TABLOCK]
)] '''
pd.read_sql_query(query,conn_british)
and the error : near "BULK": syntax error
I also tried
'''COPY table_name
FROM '\Documents\file.csv'
DELIMITER ','
'''
but I get the same error