<commit_before>import sqlite3

global_db_path = None

# Note that EVERY function that does database operations
# should include at least one call to either conn.commit()
# or conn.rollback() - and there shouldn't be any DB access
# after the last such call in a given function. (IOW, don't
# leave uncommitted changes around.)

class Table(object):

	@classmethod
	def create(cls):
		"""Creates the table in the database if it doesn't already exist."""
		raise NotImplementedError

def init(db_path):
        global global_db_path
        global_db_path = db_path

	# Create tables
	TokenIdMapping.create()

class TokenIdMapping(Table):

	@classmethod
	def create(cls):
                conn = sqlite3.connect(global_db_path)
		conn.execute("""
			CREATE TABLE IF NOT EXISTS token_id_mapping (
				person_id TEXT,<commit_msg>Add note about hackiness of db system<commit_after>import sqlite3

# This is really hacky. At some point it should really get replaced with a proper
# database system that can share connections between threads, et cetera - but for
# now, this works.

global_db_path = None

def init(db_path):
        global global_db_path
        global_db_path = db_path

	# Create tables
	TokenIdMapping.create()

class TokenIdMapping(object):

	@classmethod
	def create(cls):
                conn = sqlite3.connect(global_db_path)
		conn.execute("""
			CREATE TABLE IF NOT EXISTS token_id_mapping (
				person_id TEXT,
{'fraction_non_alphanumeric': 0.07137858642407278, 'fraction_numerical': 0.0027991602519244225, 'mean_word_length': 3.814814814814815, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1151929', 'n_tokens_mistral': 446, 'n_tokens_neox': 414, 'n_words': 152}