How to use the pymonetdb.connect function in pymonetdb

To help you get started, we’ve selected a few pymonetdb examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github MonetDB / MonetDBLite-C / clients / examples / python / basics.py View on Github external
# License, v. 2.0.  If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright 1997 - July 2008 CWI, August 2008 - 2018 MonetDB B.V.

from __future__ import print_function

import logging

#configure the logger, so we can see what is happening
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger('monetdb')

import pymonetdb

x = pymonetdb.connect(username="monetdb", password="monetdb", hostname="localhost", database="demo")
c = x.cursor()

# some basic query
c.arraysize=100
c.execute('select * from tables')
results = c.fetchall()
x.commit()
print(results)
github MonetDB / MonetDBLite-C / sql / benchmarks / tpch / fileleak / Tests / delete_all.SQL.py View on Github external
import pymonetdb
import os, sys, time

port = int(os.environ['MAPIPORT'])
db = os.environ['TSTDB']
host = os.environ['MAPIHOST']

dbh = pymonetdb.connect(hostname=host,port=port,database=db,autocommit=True)

cursor = dbh.cursor();

cursor.execute('select p.*, "location", "count", "column" from storage(), (select value from env() where name = \'gdk_dbpath\') as p where "table"=\'lineitem\' order by "column"');
res = (cursor.fetchall())
for (dbpath, fn, count, column) in res:
    fn =  os.path.join(dbpath, 'bat', fn + '.tail');
    print(column, int(os.path.getsize(fn)), count)

cursor.execute('delete from lineitem;');

cursor.execute('select "column", "count" from storage() where "table" = \'lineitem\' order by "column"');
print(cursor.fetchall())

cursor.execute('select p.*, "location", "count", "column" from storage(), (select value from env() where name = \'gdk_dbpath\') as p where "table"=\'lineitem\' order by "column"');
res = (cursor.fetchall())
github MonetDB / MonetDBLite-C / clients / examples / python / sqlsample.py View on Github external
#!/usr/bin/env python

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0.  If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright 1997 - July 2008 CWI, August 2008 - 2018 MonetDB B.V.

from __future__ import print_function

import pymonetdb
import sys

dbh = pymonetdb.connect(port=int(sys.argv[1]),database=sys.argv[2],hostname=sys.argv[3],autocommit=True)

cursor = dbh.cursor();
cursor.execute('select 1;')
print(cursor.fetchall())

cursor = dbh.cursor();
cursor.execute('select 2;')
print(cursor.fetchone())

# deliberately executing a wrong SQL statement:
try:
    cursor.execute('( xyz 1);')
except pymonetdb.OperationalError as e:
    print(e)

cursor.execute('create table python_table (i smallint,s string);');
github MonetDB / MonetDBLite-C / sql / benchmarks / tpch / fileleak / Tests / leaks.SQL.py View on Github external
import pymonetdb
import os, sys, time

port = int(os.environ['MAPIPORT'])
db = os.environ['TSTDB']
host = os.environ['MAPIHOST']

dbh = pymonetdb.connect(port=port,database=db,hostname=host,autocommit=True)

cursor = dbh.cursor();

cursor.execute('select p.*, "location", "count", "column" from storage(), (select value from env() where name = \'gdk_dbpath\') as p where "table"=\'lineitem\' order by "column"');
res = (cursor.fetchall())
for (dbpath, fn, count, column) in res:
    fn =  os.path.join(dbpath, 'bat', fn + '.tail');
    print(column, int(os.path.getsize(fn)), count)
github MonetDB / MonetDBLite-C / clients / examples / python / perf.py View on Github external
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright 1997 - July 2008 CWI, August 2008 - 2018 MonetDB B.V.

import time

#configure the logger, so we can see what is happening
#import logging
#logging.basicConfig(level=logging.DEBUG)
#logger = logging.getLogger('monetdb')


import pymonetdb

t = time.time()
x = pymonetdb.connect(database="demo")
c = x.cursor()
c.arraysize=10000
c.execute('select * from tables, tables')
results = c.fetchall()

pymonetdb

Native MonetDB client Python API

MPL-2.0
Latest version published 23 days ago

Package Health Score

69 / 100
Full package analysis