-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_db.py
More file actions
39 lines (30 loc) · 828 Bytes
/
Copy pathcreate_db.py
File metadata and controls
39 lines (30 loc) · 828 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
32
33
34
35
36
37
38
39
import os
import sqlite3
from environs import Env
import settings
def create_tables(fs, cursor):
cursor.execute(
"""CREATE TABLE IF NOT EXISTS vacancies(
id INTEGER,
title TEXT,
employer TEXT,
employer_url TEXT,
salary TEXT,
address TEXT,
requirements TEXT,
responsibilities TEXT,
vacancy_url TEXT,
response_url TEXT,
created_at INTEGER,
responded INTEGER,
processed INTEGER
);
"""
)
fs.commit()
if __name__ == '__main__':
env = Env()
env.read_env()
db = sqlite3.connect(os.path.join(settings.DB_ROOT_FOLDER, env.str('DATABASE', 'vacancies.sqlite3')))
cursor = db.cursor()
create_tables(db, cursor)