bp_database.py
Go to the documentation of this file.
1 """ BLESSED PLOTS - SQLITE3 INTERFACE
2 
3 This module includes functions which provide interaction with an SQLite3
4 database.
5 """
6 
7 import sqlite3 #/// SQLite3 bindings
8 import bp_config as config #/// User Configuration
9 from bp_docdb import * #/// DocDB interface and classes
10 
12  """A class for interacting with an SQLite3 file
13 
14  All relevant metadata associated with a single DocDB document will be
15  stored in a member of this class.
16 
17  Attributes:
18  path (str) : Path to SQLite3 file
19  schema (str) : Path to SQLite3 schema definition file
20  conn (sqlite) : SQLite3 connection
21  """
22  # Constructor
23  def __init__(self):
24  # Class variables
25  self.path = config.SQLITE_FILE_PATH
26  self.schema = config.SQLITE_SCHEMA_PATH
27  self.conn = sqlite3.connect(self.path)
28  self.conn.text_factory = str
29 
30  # Open the database file and apply schema
31  f = open(self.schema, 'r')
32  sql = f.read()
33  self.conn.executescript(sql)
34  f.close()
procfile open("FD_BRL_v0.txt")