#!/usr/bin/python
# -*- coding: utf-8 -*-

import psycopg2

from PiAnoS.extra import DatabaseExtended
from PiAnoS.release import parseConnectionString

from build import get_pianos_sql_udb

################################################################################
# 
################################################################################

class dbNoCheck( DatabaseExtended ):
    def __init__( self, url, verbose = True, dont_register_admin = False, use_dict_cursors = True ):
        hostname, port, name, user, password, self.url = parseConnectionString( url )
        print "Connecting to '%s'" % self.url

        self.conn = psycopg2.connect( host = hostname, port = port, database = name, user = user, password = password, cursor_factory = psycopg2.extras.DictCursor if use_dict_cursors else None )
        
content = get_pianos_sql_udb( "../../libs/microdb" )

db = dbNoCheck( "pgsql://pianos:pianos@localhost/pianos", False )
db.query( content )
db.commit()
