Example #1
0
def run(verdictdbConfig):
  port=verdictdbConfig['port']
  password=verdictdbConfig['password']
  conn=pyverdict.postgres(host=verdictdbConfig['host'],user=verdictdbConfig['username'],password=password,port=port,dbname=verdictdbConfig['database-name'])
  conn.set_loglevel("ERROR")
  scramblePercent = verdictdbConfig['scramblePercent']
  scrambleFrac = scramblePercent / 100.0
  
  # just to make sure the verdictdb metadata exists first
  df=conn.sql('CREATE SCRAMBLE "public"."ssb_test_scramble" from "public"."customer" SIZE 0.05')
  df=conn.sql('DROP SCRAMBLE "public"."ssb_test_scramble" on "public"."customer" SIZE 0.05')
  
  # make the real scrambles
  #df=conn.sql('DROP SCRAMBLE "public"."customer_scrambled_10_percent" on "public"."customer" SIZE 0.1')
  #df=conn.sql('CREATE SCRAMBLE "public"."customer_scrambled_10_percent" from "public"."customer" SIZE 0.1')
  
  #df=conn.sql('DROP SCRAMBLE "public"."supplier_scrambled_10_percent" on "public"."supplier" SIZE 0.1')
  #df=conn.sql('CREATE SCRAMBLE "public"."supplier_scrambled_10_percent" from "public"."supplier" SIZE 0.1')
  
  #df=conn.sql('DROP SCRAMBLE "public"."date__scrambled_10_percent" on "public"."date_" SIZE 0.1')
  #df=conn.sql('CREATE SCRAMBLE "public"."date__scrambled_10_percent" from "public"."date_" SIZE 0.1')
  
  print('DROP SCRAMBLE "public"."lineorder_scrambled_'+str(scramblePercent)+'_percent" on "public"."lineorder" SIZE ' + str(scrambleFrac))
  df=conn.sql('DROP SCRAMBLE "public"."lineorder_scrambled_'+str(scramblePercent)+'_percent" on "public"."lineorder" SIZE ' + str(scrambleFrac))
  print('CREATE SCRAMBLE "public"."lineorder_scrambled_'+str(scramblePercent)+'_percent" from "public"."lineorder" SIZE ' + str(scrambleFrac))
  df=conn.sql('CREATE SCRAMBLE "public"."lineorder_scrambled_'+str(scramblePercent)+'_percent" from "public"."lineorder" SIZE ' + str(scrambleFrac))
Example #2
0
def run(verdictdbConfig):
    port = verdictdbConfig['port']
    password = verdictdbConfig['password']
    conn = pyverdict.postgres(host=verdictdbConfig['host'],
                              user=verdictdbConfig['username'],
                              password=password,
                              port=port,
                              dbname=verdictdbConfig['database-name'])
    conn.set_loglevel("ERROR")
    scramblePercent = verdictdbConfig['scramblePercent']
    scrambleFrac = scramblePercent / 100.0

    df = conn.sql('DROP SCRAMBLE "public"."lineorder_scrambled_' +
                  str(scramblePercent) +
                  '_percent" on "public"."lineorder" SIZE ' +
                  str(scrambleFrac))
import os
import pyverdict,json

verdictdbConfig = json.load(open(os.path.join(os.path.dirname(__file__),'..','..','verdictdb.config.json')))
port=verdictdbConfig['port']
password=verdictdbConfig['password']
conn=pyverdict.postgres(host='localhost',user='******',password=password,port=port,dbname='crossfilter-eval-db')
conn.set_loglevel("ERROR")
df=conn.sql('DROP SCRAMBLE "public"."movies_scrambled_10_percent" on "public"."movies" SIZE 0.1')
df=conn.sql('DROP SCRAMBLE "public"."movies_scrambled_50_percent" on "public"."movies" SIZE 0.5')
df=conn.sql('DROP SCRAMBLE "public"."flights_scrambled_10_percent" on "public"."flights" SIZE 0.1')
df=conn.sql('DROP SCRAMBLE "public"."flights_scrambled_50_percent" on "public"."flights" SIZE 0.5')
df=conn.sql('DROP SCRAMBLE "public"."weather_scrambled_10_percent" on "public"."weather" SIZE 0.1')
df=conn.sql('DROP SCRAMBLE "public"."weather_scrambled_50_percent" on "public"."weather" SIZE 0.5')


Example #4
0
print(args.sampling_ratio)
sampling_ratio = args.sampling_ratio

if not os.path.exists('../../output/verdict/tpch-{}'.format(sampling_ratio)):
    # logger.info('creating directory Accuracy')
    os.makedirs('../../output/verdict/tpch-{}'.format(sampling_ratio))

if __name__ == '__main__':
    print("main executing")
    directory = os.fsencode(
        '/home/fotis/Desktop/tpch_2_17_0/dbgen/tpch_queries_10/')

    verdict = pyverdict.postgres('127.0.0.1',
                                 5433,
                                 dbname='tpch1g',
                                 user='******',
                                 password='******')
    verdict.sql("DROP ALL SCRAMBLE public.lineitem;")
    verdict.sql("DROP ALL SCRAMBLE public.orders;")
    verdict.sql("DROP ALL SCRAMBLE public.partsupp;")
    res = verdict.sql("""CREATE SCRAMBLE IF NOT EXISTS public.lineitem_x
                      FROM public.lineitem SIZE {}""".format(sampling_ratio))
    verdict.sql("""CREATE SCRAMBLE IF NOT EXISTS public.orders_x
                      FROM public.orders SIZE {}""".format(sampling_ratio))
    verdict.sql("""CREATE SCRAMBLE IF NOT EXISTS public.partsupp_x
                      FROM public.partsupp SIZE {}""".format(sampling_ratio))
    query_answers_dic = {}
    query_answers_dic['query_name'] = []
    query_answers_dic['time'] = []
    query_names = {}
Example #5
0
    rand_idx = random.randint(0, 2)
    product = product_list[rand_idx]
    price = (rand_idx + 2) * 10 + random.randint(0, 10)
    cur.execute('INSERT INTO testschema.sale (product, price)' +
                '   VALUES (\'{:s}\', {:f})'.format(product, price))

# sql using cur
cur.execute("SELECT product, AVG(price) " + "FROM testschema.sale " +
            "GROUP BY product " + "ORDER BY product")
df = cur.fetchall()
print(df)

cur.close()

# create connection
verdict_conn = pyverdict.postgres(host='localhost',
                                  user='******',
                                  dbname='postgres',
                                  password='',
                                  port=5432)

# create scramble table

verdict_conn.sql(
    'CREATE SCRAMBLE testschema.sale_scrambled from testschema.sale')

# run query
df = verdict_conn.sql("SELECT product, AVG(price) " + "FROM testschema.sale " +
                      "GROUP BY product " + "ORDER BY product")
print(df)
 def create_connection(self):
     connection = pyverdict.postgres(host=self.config['host'], user='******', password=self.config['password'], port=self.config['port'], dbname='crossfilter-eval-db')
     connection.set_loglevel("ERROR")
     return connection
Example #7
0
 def create_connection(self):
     connection = pyverdict.postgres(host=self.config['host'], user=self.config['username'], password=self.config['password'], port=self.config['port'], dbname=self.config['database-name'])
     connection.set_loglevel("ERROR")
     return connection
Example #8
0
if not os.path.exists(
        '../../output/verdict/instacart-1000-{}'.format(sampling_ratio)):
    # logger.info('creating directory Accuracy')
    os.makedirs(
        '../../output/verdict/instacart-1000-{}'.format(sampling_ratio))

if __name__ == '__main__':
    print("main executing")
    with open('../../input/instacart_queries/queries-test-1000.pkl',
              'rb') as f:
        queries = pickle.load(f)

    verdict = pyverdict.postgres('127.0.0.1',
                                 5433,
                                 dbname='instacart',
                                 user='******',
                                 password='******')
    verdict.sql("DROP ALL SCRAMBLE public.order_products")
    verdict.sql("DROP ALL SCRAMBLE public.orders")

    verdict.sql(
        """CREATE SCRAMBLE IF NOT EXISTS public.order_products_instacart_x
                   FROM public.order_products SIZE {}""".format(
            sampling_ratio))
    verdict.sql("""CREATE SCRAMBLE IF NOT EXISTS public.orders_instacart_x
                   FROM public.orders SIZE {}""".format(sampling_ratio))
    #    print(res)
    #    sys.exit(0)
    query_answers_dic = {}
    query_answers_dic['query_name'] = []