forked from dunderrrrrr/youtube-telegram-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdb.py
23 lines (19 loc) · 705 Bytes
/
db.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import os
from sqlalchemy import create_engine, ForeignKey
from sqlalchemy import Column, Date, Integer, String
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship, backref
TOP_LEVEL_DIR = os.path.abspath(os.curdir)
engine = create_engine('sqlite:///' + TOP_LEVEL_DIR + '/sqlite.db', echo=True)
Base = declarative_base()
class vids(Base):
__tablename__ = "vids"
id = Column(Integer, primary_key=True)
v_title = Column(String)
v_id = Column(String)
v_date = Column(String)
def __init__(self, v_title, v_id, v_date):
self.v_title = v_title
self.v_id = v_id
self.v_date = v_date
Base.metadata.create_all(engine)