<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-

import psycopg2
from pprint import pprint
from mosql.query import select, left_join
from mosql.db import *

db = Database(psycopg2, host='127.0.0.1')

with db as cur:

    cur.execute(select(
        'person',
        joins = left_join('detail', using='person_id'),
        order_by = 'person_id'
    ))

    groups = group(['person_id'], cur, drop_key=True, to_dict=True, to_index=True)

    pprint(groups)

    print pluck(groups['mosky',], 'val')<commit_msg>made the output of join_with_db_usage.py shorter<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-

import psycopg2
from pprint import pprint
from mosql.query import select, left_join
from mosql.db import *

db = Database(psycopg2, host='127.0.0.1')

with db as cur:

    cur.execute(select(
        'person',
        joins = left_join('detail', using='person_id'),
        order_by = 'person_id'
    ))

    groups = group(['person_id'], cur, drop_key=True, to_dict=True, to_index=True)

    pprint(groups['mosky',])

    print pluck(groups['mosky',], 'val')
{'fraction_non_alphanumeric': 0.15032080659945005, 'fraction_numerical': 0.016498625114573784, 'mean_word_length': 3.607594936708861, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '4798512', 'n_tokens_mistral': 398, 'n_tokens_neox': 385, 'n_words': 88}