-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsqlite_test.py
More file actions
48 lines (34 loc) · 1.56 KB
/
sqlite_test.py
File metadata and controls
48 lines (34 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import sqlite3
from sqlite3 import Error
class Sqlite_test:
def __init__(self, database):
self.database = database
self.connection = sqlite3.connect(database)
self.cursor = self.connection.cursor()
def addToSavedArtists(self, artist_id, genre_id):
self.cursor.execute("INSERT INTO saved_artists VALUES ('{}', '{}')".format(artist_id, genre_id))
self.connection.commit()
self.connection.close()
def removeArtist(self, artist_id):
self.cursor.execute("DELETE FROM saved_artists WHERE artist_id='{}'".format(artist_id))
self.connection.commit()
self.connection.close()
def addToQueue(self, artist_id):
self.cursor.execute("INSERT INTO artist_queue VALUES ('{}')".format(artist_id))
self.connection.commit()
self.connection.close()
def removeFromQueue(self,artist_id):
self.cursor.execute("DELETE FROM artist_queue WHERE artist_id='{}'".format(artist_id))
self.connection.commit()
self.connection.close()
#CREATE SAVED_ARTISTS TABLE
#--------------------------------------------------#
# sqlite.cursor.execute("""CREATE TABLE saved_artists (
# Artist_id text,
# Genre_id text
# )""")
#CREATE ARTISTS_QUEUE TABLE
#--------------------------------------------------#
# sqlite.cursor.execute("""CREATE TABLE artist_queue (
# artist_id text
# )""")