#!/usr/bin/env python
"""igcollect - PostgreSQL

Copyright (c) 2019 InnoGames GmbH
"""

from argparse import ArgumentParser
from time import time

from psycopg2 import connect
from psycopg2.extensions import ISOLATION_LEVEL_REPEATABLE_READ
from psycopg2.extras import RealDictCursor


def parse_args():
    parser = ArgumentParser()
    parser.add_argument('--prefix', default='postgres')
    parser.add_argument('--dbname', default='postgres')
    parser.add_argument('--extended', action='store_true')
    return parser.parse_args()


def main():
    args = parse_args()

    conn = connect(database=args.dbname)
    conn.set_session(
        isolation_level=ISOLATION_LEVEL_REPEATABLE_READ,
        readonly=True,
    )

    # To be formatted 2 times
    template = '{}.{{}}.{{}} {{}} {}'.format(args.prefix, int(time()))