-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathskilllist_sql.py
More file actions
31 lines (24 loc) · 993 Bytes
/
skilllist_sql.py
File metadata and controls
31 lines (24 loc) · 993 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 import create_engine, Column, Integer, String, Text
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.ext.declarative import declarative_base
engine = create_engine('sqlite:///skillbase.db')
db_session = scoped_session(sessionmaker(bind=engine))
Base = declarative_base()
Base.query = db_session.query_property()
Base.metadata.create_all(bind=engine)
class Skillbase(Base):
__tablename__ = 'skills'
id = Column(Integer, primary_key=True)
skill = Column(Text, unique=True)
link = Column(Text)
work_count = Column(Integer)
skill_words = Column(Text)
def __init__(self, skill=None, link=None, work_count=None, skill_words=None):
self.skill=skill
self.link=link
self.work_count=work_count
self.skill_words=skill_words
def __repr__(self):
return 'По навыку {} найдено {} предложений!>'.format(self.skill, self.work_count)
def create_base():
Base.metadata.create_all(bind=engine)