<commit_before>'''
Created on Aug 5, 2010

@author: apm
'''
#Test CRUD on opengemdb database
#CREATE : Create testTable
#       : Insert rows
#READ   : Read rows
#UPDATE : Change row values
#DELETE : Delete Element
#       : Drop Table

#!/usr/bin/python
import psycopg2
#note that we have to import the Psycopg2 extras library!
import sys
import pprint

def main():
    #start of script
    #Define our connection string

    conn_string = "host='gemsun01.ethz.ch' dbname='opengemdb' user='gemuser' password='<PASSWORD>'"
    
    # print the connection string we will use to connect
    print "Connecting to database\n    ->%s" % (conn_string)
    try:
        # get a connection, if a connect cannot be made an exception will be raised here
        conn = psycopg2.connect(conn_string)
        print "Connected!\n"
        
        # conn.cursor will return a cursor oject, you can use this cursor to perform queries
        cursor = conn.cursor()

        # create a Table
        cursor.execute("CREATE TABLE testTable (name char(8), value float)")
        
        # insert rows into table
        cursor.execute("INSERT INTO testTable VALUES('one', 1.0)")
        cursor.execute("INSERT INTO testTable VALUES('two', 2.0)")
        cursor.execute("INSERT INTO testTable VALUES('three', 3.0)")
        # makes changes permanent
        conn.commit()<commit_msg>Test change<commit_after>'''
Created on Aug 5, 2010

@author: apm
'''
#Test CRUD on opengemdb database
#CREATE : Create testTable
#       : Insert rows
#READ   : Read rows
#UPDATE : Change row values
#DELETE : Delete Element
#       : Drop Table

#!/usr/bin/python
import psycopg2
#note that we have to import the Psycopg2 extras library!
import sys
import pprint

def main():
    #start of script
    #Define our connection string

    conn_string = "host='gemsun01.ethz.ch' dbname='opengemdb' user='user' password=''"
    
    # print the connection string we will use to connect
    print "Connecting to database\n    ->%s" % (conn_string)
    try:
        # get a connection, if a connect cannot be made an exception will be raised here
        conn = psycopg2.connect(conn_string)
        print "Connected!\n"
        
        # conn.cursor will return a cursor oject, you can use this cursor to perform queries
        cursor = conn.cursor()

        # create a Table
        cursor.execute("CREATE TABLE testTable (name char(8), value float)")
        
        # insert rows into table
        cursor.execute("INSERT INTO testTable VALUES('one', 1.0)")
        cursor.execute("INSERT INTO testTable VALUES('two', 2.0)")
        cursor.execute("INSERT INTO testTable VALUES('three', 3.0)")
        # makes changes permanent
        conn.commit()
{'fraction_non_alphanumeric': 0.09716599190283401, 'fraction_numerical': 0.012513801987486198, 'mean_word_length': 2.817415730337079, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 6, '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': '6909628', 'n_tokens_mistral': 811, 'n_tokens_neox': 770, 'n_words': 292}