-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodel.py
More file actions
32 lines (21 loc) · 772 Bytes
/
model.py
File metadata and controls
32 lines (21 loc) · 772 Bytes
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
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import create_engine
from sqlalchemy import Column, Integer, String, Text
from sqlalchemy.orm import sessionmaker
ENGINE = None
Session = None
Base = declarative_base()
#Creating database to store song information.
class Fingerprint(Base):
__tablename__ = "fingerprints"
id = Column(Integer, primary_key = True)
title = Column(String, nullable = True)
artist = Column(String, nullable = True)
album = Column(String, nullable = True)
fingerprint = Column(Text, nullable = True)
def connect():
global ENGINE
global Session
ENGINE = create_engine("sqlite:///fingerprint_database.db", echo=True)
Session = sessionmaker(bind=ENGINE)
return Session()