contentmatcher/create_db.py

47 lines
1.4 KiB
Python

#!/usr/bin/python3
from csv import unregister_dialect
#import email
from sqlite3 import Date
#from ssl import _PasswordType
#from xmlrpc.client import DateTime
#from matplotlib.pyplot import title
from sqlalchemy import Column, Integer, Float, String, Text, TIMESTAMP,ForeignKey
from sqlalchemy.ext.declarative import declarative_base
#from sqlalchemy.orm import relationship
from sqlalchemy import func, create_engine,join
from config import CONFIG
Base = declarative_base()
class User(Base):
__tablename__ = 'user'
id = Column(Integer, primary_key=True, autoincrement=True)
# username = Column(String)
# password = Column(String) #mogoče raje kaj drugega, neki hash passworda al neki
# email = Column(String)
class Card(Base):
__tablename__ = 'card'
id = Column(Integer, primary_key=True, autoincrement=True)
title = Column(String(1024))
interest_rate = Column(Float)
owner_id = Column(Integer, ForeignKey("user.id"), nullable=False)
# shared = Column(Bool)
# item_location = Column(String)
# item_type = Column(String)
# item_size = Column(Integer)
#ali
# date_added = Column(String)
# last_review = Column(DateTime)
# interval = Column(Integer)
# due = Column(DateTime)
engine = create_engine(CONFIG['DB_CONNECTION'])
Base.metadata.create_all(engine)