def setUp(self): app = Flask("tests", static_url_path="/static") app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = True app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:////tmp/test_idb.db" db.init_app(app) db.app = app db.configure_mappers() db.create_all()
def dbCreate(): db.configure_mappers()
def migration(): db.configure_mappers() db.create_all()
import time from time import mktime from datetime import datetime import json from sqlalchemy import exists import os import re, string # setting up tables and models app = Flask(__name__, static_url_path='/static') app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///idb.db' db.init_app(app) db.app = app db.configure_mappers() db.create_all() # for many to many adding # Senpai notice me! # http://docs.sqlalchemy.org/en/latest/orm/tutorial.html#building-a-many-to-many-relationship # cache the processed data to avoid collision hashed = {} cities = {} tweet_ids = {} # scan throught our private repo searching for data json_list = [] for stuff in os.listdir("../cs373-tweetCity/"): if stuff.endswith(".json") and stuff.startswith("new"):