#cursor not printing in sqlite 3

1 messages · Page 1 of 1 (latest)

dense meteor
#

!format

knotty sageBOT
#
Code Formatting

When sharing code with the community, please use the correct formatting for ease of readability.

Example

```py
YOUR CODE HERE
```

Those are back ticks not single quotes, typically the key above TAB

dense meteor
#
import sqlite3
from input import Game
connection = sqlite3.connect("gta.db")
cursor = connection.cursor()

# cursor.execute("CREATE TABLE gta (year INTEGER, name TEXT PRIMARY KEY, city TEXT)")

# release_list = [
#     (1997, "Grand Theft Auto", "state of New Guernsey"),
#     (1999, "Grand Theft Auto 2", "Anywhere, USA"),
#     (2001, "Grand Theft Auto III", "Liberty City"),
#     (2002, "Grand Theft Auto: Vice City", "Vice City"),
#     (2004, "Grand Theft Auto: San Andreas", "state of San Andreas"),
#     (2008, "Grand Theft Auto IV", "Liberty City"),
#     (2013, "Grand Theft Auto V", "Los Santos")
# ]
# cursor.executemany("INSERT INTO gta VALUES (?,?,?)",release_list)

game_1 = Game(2025, 'Grand Theft Auto VI', 'London')
game_2 = Game(2030, 'Grand Theft Auto VII', 'Detriot')



# cursor.execute("INSERT INTO gta VALUES (:year, :city, :city)", {'year': game_1.year,'city': game_1.name,'city': game_1.city,})  
# connection.commit()

# cursor.execute("INSERT INTO gta VALUES (:year, :city, :city)", {'year': game_2.year,'city': game_2.name,'city': game_2.city,})  
# connection.commit()


cursor.execute("SELECT * FROM gta WHERE city=:city",{'city': 'London'})
print(cursor.fetchall)


# cursor.execute("SELECT * FROM gta WHERE year = 2025")
# print(cursor.fetchone())


connection.commit()


connection.close()
#

the following comes up when i try to print my query :

#

<built-in method fetchall of sqlite3.Cursor object at 0x000001F2C22E24C0>

ashen sky
#

You have to call fetchall

#

()

#

You're missing

#

()

dense meteor
#

omfg

#

mb sorry for wasting ur time

#

wait it printed twice