I'm not being able to wrap my head around.
Exactly the same code, exactly the same interpreter, works everywhere else but not on Visual Studio Code.
Let's consider the following example:
import sqlite3
_connection = sqlite3.connect(":memory:")
_connection.row_factory = sqlite3.Row
create_table = """
create table food (
id int not null,
data json not null,
primary key(id)
)
"""
insert = """
insert into food (id, data)
values (1, '{"name": "Steak"}')
"""
update = """
update food
set data = json_set(data, '$.name', 'Bacon and Eggs')
where id = 1
"""
fetch_query = "select json_extract(data, '$.name') as name from food where id = 1"
with _connection:
_connection.execute(create_table)
_connection.execute(insert)
_connection.execute(update)
food = _connection.execute(fetch_query)
new_food = dict(food.fetchone()).get('name')
print(new_food)
It should print out Bacon and Eggs but Visual Studio Code complains json_set is not a function.
How do I check what version of sqlite3 is being used by Visual Studio Code internally? Not sure why running it from vs code doesn't behave the same as running it from an external terminal.
Update 1
Linux Terminal
Update 2
I'm not relying on VS code to figure out which version of python to use. I'm typing it explicitly. Nothing to do with pip I suppose. I'm using the same version of pip anyways.



