Jimmy
Jimmy

Reputation: 145

How to make column names case-sensitive of Sqlite3 in Python?

I want to create a table as below:

import sqlite3 as sql
con = sql.connect('test.db')
cur = con.cursour()
sql_command = "create table test(dose float, Dose float, DOSE float)"
cur.execute(sql_command)

But i got an error: OperationalError: duplicate column name: Dose. I wonder how to make the table title case-sensitive?

Upvotes: 3

Views: 4659

Answers (1)

Evgeny
Evgeny

Reputation: 4551

Sqlite column names are case-insensitive, according to this. I think it is enforced on C level of implementation.

As a side-note, mixing column names dose, Dose, etc does not seem a great idea even if permitted, unless as an exploratory exercise.

Also this can be useful: Is SQL syntax case sensitive?

Upvotes: 4

Related Questions