<commit_before>import sqlite3
import sys

database_path='database/'

if len(sys.argv) == 2:
	database_path += sys.argv[1]
else:
	database_path += 'bfdatabase.db'

conn = sqlite3.connect(database_path)

c = conn.cursor()

#for row in c.execute('SELECT * FROM airports'):
#	print(row)

c.execute('SELECT * FROM lookup')

#print(list(map(lambda x: x[0], c.description)))

c.execute('SELECT fl_id FROM lookup WHERE fl_name=?', ('New York City',))

air_id = (c.fetchone())[0]

print(air_id)

for year in range(1993,2015):
	rows = c.execute('SELECT in_degree_people, out_degree_people FROM airports WHERE year=? AND market_id=?', (year,air_id))
	print(year)
	#now sum for all airports
	total_in = 0
	total_out = 0
	for pair in rows:
		total_in += pair[0]
		total_out += pair[1]
	print(total_in, total_out)
<commit_msg>added example of how to fetch data from both econ and flight tables<commit_after>import sqlite3
import sys

database_path='database/'

if len(sys.argv) == 2:
	database_path += sys.argv[1]
else:
	database_path += 'bfdatabase.db'

conn = sqlite3.connect(database_path)

c = conn.cursor()

#for row in c.execute('SELECT * FROM airports'):
#	print(row)

c.execute('SELECT * FROM lookup')

#print(list(map(lambda x: x[0], c.description)))

c.execute('SELECT fl_id FROM lookup WHERE fl_name=?', ('New York City',))

air_id = (c.fetchone())[0]

print(air_id)

for year in range(1993,2015):
	rows_fl = c.execute('SELECT in_degree_people, out_degree_people FROM airports WHERE year=? AND market_id=?', (year,air_id))
	print(year)
	#now sum for all airports
	total_in = 0
	total_out = 0
	for pair in rows_fl:
		total_in += pair[0]
		total_out += pair[1]
	rows_ec = c.execute('SELECT mean_value FROM econ_data WHERE year=? AND MSA_id_airline=?', (year, int(air_id)))
	#sum for all quarters
	total_ec = 0
	for value in rows_ec:
		total_ec += value[0]
	print(total_in, total_out, "Econ: ", total_ec)

{'fraction_non_alphanumeric': 0.14112690889942076, 'fraction_numerical': 0.020010531858873092, 'mean_word_length': 5.229508196721311, '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': '7272693', 'n_tokens_mistral': 741, 'n_tokens_neox': 704, 'n_words': 193}