Changeset: cbd7a77a0032 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=cbd7a77a0032
Modified Files:
        monetdb5/extras/pyapi/Benchmarks/monetdb_testing.py
        tools/embeddedpy/embedded_module.c
        tools/embeddedpy/setup.py
Branch: pyapi
Log Message:

Changed name of python module from monetdb to monetdb_embedded so it works if 
you have the MAPI module installed.


diffs (83 lines):

diff --git a/monetdb5/extras/pyapi/Benchmarks/monetdb_testing.py 
b/monetdb5/extras/pyapi/Benchmarks/monetdb_testing.py
--- a/monetdb5/extras/pyapi/Benchmarks/monetdb_testing.py
+++ b/monetdb5/extras/pyapi/Benchmarks/monetdb_testing.py
@@ -745,25 +745,25 @@ else:
 
         execute_test(input_type, numpy_init, numpy_load, numpy_execute, 
numpy_clear, numpy_final)
     elif str(args_input_database).lower() == "monetdbembedded":
-        import monetdb, csv
+        import monetdb_embedded, csv
 
         def monetdbembedded_init():
-            monetdb.init('/tmp/dbfarm')
-            try: monetdb.sql('DROP TABLE integers')
+            monetdb_embedded.init('/tmp/dbfarm')
+            try: monetdb_embedded.sql('DROP TABLE integers')
             except: pass
 
         def monetdbembedded_load():
             with open(input_file, 'rb') as csvfile:
                 reader = csv.reader(csvfile)
                 result = [int(x[0]) for x in reader]
-                monetdb.create('integers', ['i'], result)
+                monetdb_embedded.create('integers', ['i'], result)
 
         def monetdbembedded_execute():
-            result = monetdb.sql('SELECT * FROM integers')
+            result = monetdb_embedded.sql('SELECT * FROM integers')
             function(result['i'])
 
         def monetdbembedded_clear():
-            monetdb.sql('DROP TABLE integers')
+            monetdb_embedded.sql('DROP TABLE integers')
 
         def monetdbembedded_final():
             os.remove(input_file)
diff --git a/tools/embeddedpy/embedded_module.c 
b/tools/embeddedpy/embedded_module.c
--- a/tools/embeddedpy/embedded_module.c
+++ b/tools/embeddedpy/embedded_module.c
@@ -15,13 +15,13 @@
 static char module_docstring[] =
     "This module provides a MonetDB client.";
 static char init_docstring[] =
-    "monetdb.init(directory) => Initialize the SQL client with the given 
database directory.";
+    "monetdb_embedded.init(directory) => Initialize the SQL client with the 
given database directory.";
 static char sql_docstring[] =
-    "monetdb.sql(query) => Execute a SQL query on the database. Returns the 
result as a dictionary of Numpy Arrays.";
+    "monetdb_embedded.sql(query) => Execute a SQL query on the database. 
Returns the result as a dictionary of Numpy Arrays.";
 static char create_docstring[] =
-    "monetdb.create(tablename, dictionary), monetdb.create(tablename, 
column_names, values) => Create a SQL table from the given Python objects, 
objects must either be a (column name, value) dictionary or a list of column 
names and a list of values";
+    "monetdb_embedded.create(tablename, dictionary), 
monetdb_embedded.create(tablename, column_names, values) => Create a SQL table 
from the given Python objects, objects must either be a (column name, value) 
dictionary or a list of column names and a list of values";
 static char insert_docstring[] =
-    "monetdb.insert(tablename, dictionary), monetdb.insert(tablename, 
column_names, values) => Insert a set of values into a SQL table";
+    "monetdb_embedded.insert(tablename, dictionary), 
monetdb_embedded.insert(tablename, column_names, values) => Insert a set of 
values into a SQL table";
 
 static PyMethodDef module_methods[] = {
     {"init", monetdb_init, METH_O, init_docstring},
@@ -31,11 +31,11 @@ static PyMethodDef module_methods[] = {
     {NULL, NULL, 0, NULL}
 };
 
-PyMODINIT_FUNC initmonetdb(void);
-PyMODINIT_FUNC initmonetdb(void)
+PyMODINIT_FUNC initmonetdb_embedded(void);
+PyMODINIT_FUNC initmonetdb_embedded(void)
 {
     //initialize module
-    PyObject *m = Py_InitModule3("monetdb", module_methods, module_docstring);
+    PyObject *m = Py_InitModule3("monetdb_embedded", module_methods, 
module_docstring);
     if (m == NULL)
         return;
 
diff --git a/tools/embeddedpy/setup.py b/tools/embeddedpy/setup.py
--- a/tools/embeddedpy/setup.py
+++ b/tools/embeddedpy/setup.py
@@ -4,7 +4,7 @@ import ntpath
 import os
 import sys
 
-package_name = "monetdb" #if you change this you also need to change the init 
function in embedded_module.c
+package_name = "monetdb_embedded" #if you change this you also need to change 
the init function in embedded_module.c
 
 if os.name == 'nt':
     print("Windows is not currently supported.")
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to