Skip to content

Commit 7550b2b

Browse files
authored
Update README.md
1 parent 00db67a commit 7550b2b

File tree

1 file changed

+27
-7
lines changed

1 file changed

+27
-7
lines changed

README.md

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@ Python adapter via callout for InterSystems Data Platforms.
44
# Installation
55

66
1. Load ObjectScript code (i.e. `do $system.OBJ.LoadDir("C:\InterSystems\Repos\Python\isc\py\","*.cls",,1)`).
7-
2. Place [callout DLL/SO](https://github.com/intersystems-ru/PythonAdapter/releases) in the `bin` folder of your InterSystems IRIS installation. Library file should be placed into a path returned by `write ##class(isc.py.Callout).GetLib()`.
7+
2. Place [callout DLL/SO/DYLIB](https://github.com/intersystems-ru/PythonAdapter/releases) in the `bin` folder of your InterSystems IRIS installation. Library file should be placed into a path returned by `write ##class(isc.py.Callout).GetLib()`.
88

99
## Windows
1010

1111
3. Check that your `PYTHONHOME` environment variable points to Python 3.6.
1212
4. Check that your SYSTEM `PATH` environment variable has `PYTHONHOME` variable (or directory it points to).
1313

14-
## Linux
14+
## Linux && Mac
1515

16-
3. Check that your SYSTEM `PATH` environment variable has `/usr/lib`, preferably at the begining
16+
3. Check that your SYSTEM `PATH` environment variable has `/usr/lib` and `/usr/lib/x86_64-linux-gnu`, preferably at the begining. Use `/etc/environment` file to set environment variables.
1717

18-
If you modified environment variables (for Windows or Linux) restart your InterSystems product.
18+
If you modified environment variables restart your InterSystems product.
1919

2020
# Use
2121

@@ -26,7 +26,7 @@ If you modified environment variables (for Windows or Linux) restart your InterS
2626

2727
```
2828
set sc = ##class(isc.py.Callout).Setup()
29-
set sc = ##class(isc.py.Callout).SimpleString("x='HELLO'", "x", , .x)
29+
set sc = ##class(isc.py.Main).SimpleString("x='HELLO'", "x", , .x)
3030
write x
3131
set sc = ##class(isc.py.Callout).Finalize()
3232
set sc = ##class(isc.py.Callout).Unload()
@@ -41,6 +41,9 @@ Generally the main interface to Python is `isc.py.Main`. It offers these methods
4141
- `GetStatus()` - returns last occured exception in Python and clears it.
4242
- `GetVariableJson(variable, .stream, useString)` - get JSON serialization of variable.
4343
- `GetVariablePickle(variable, .stream, useString)` - get Pickle serialization of variable.
44+
- `ExecuteQuery(query, variable, type)` - create resultset (pandas `dataframe` or `list`) from sql query and set it into `variable`.
45+
- `ImportModule(module, .imported, .alias)` - import module with alias.
46+
- `GetModuleInfo(module, .imported, .alias)` - get module alias and is it currently imported.
4447

4548
Possible Serializations:
4649
- `##class(isc.py.Callout).SerializationStr` - Serialization by str() function
@@ -62,6 +65,7 @@ Interoperability adapter `isc.py.ens.Operation` offers abulity to interact with
6265

6366
- Execute Python code via `isc.py.msg.ExecutionRequest`. Returns `isc.py.msg.ExecutionResponse` with requested variable values
6467
- Execute Python code via `isc.py.msg.StreamExecutionRequest`. Returns `isc.py.msg.StreamExecutionResponse` with requested variable values. Same as above, but accepts and returns streams instead of strings.
68+
- Set dataset from SQL Query with `isc.py.msg.QueryRequest`. Returns `Ens.Response`.
6569
- Save Python conext via `isc.py.msg.SaveRequest`. Returns `Ens.StringResponse` with context id.
6670
- Restore Python context via `isc.py.msg.RestoreRequest`.
6771

@@ -71,7 +75,7 @@ Check request/response classes documentation for details.
7175

7276
Along with callout code and Interoperability adapter there's also a test Interoperability Production and test Business Process. To use them:
7377

74-
1. In OS bash execute `pip install pyodbc pandas matplotlib seaborn`.
78+
1. In OS bash execute `pip install pandas matplotlib seaborn`.
7579
2. Execute: `do ##class(isc.py.test.CannibalizationData).Import()` to populate test data.
7680
3. Create ODBC or JDBC connection to the namespace with data.
7781
4. In test Business Process `isc.py.test.Process` edit annotation for `ODBC connection` or `JDBC connection` call, specifying correct DSN.
@@ -83,8 +87,9 @@ Along with callout code and Interoperability adapter there's also a test Interop
8387

8488
Notes.
8589

86-
- If you want to use JDBC connection, install JayDeBeApi: `pip install JayDeBeApi`. On linux you might need to install `apt-get install python-apt`.
90+
- If you want to use `ODBC` connection, install pyodbc: `pip install pyodbc`.
8791
- For ODBC on Linux insall `unixodbc unixodbc-dev python-pyodbc`.
92+
- If you want to use `JDBC` connection, install JayDeBeApi: `pip install JayDeBeApi`. On linux you might need to install `apt-get install python-apt`.
8893
- If you get errors similar to `undefined symbol: _Py_TrueStruct` in `isc.py.ens.Operation`operation set setting `PythonLib` to `libpython3.6m.so` or even to a full path of the shared library.
8994

9095

@@ -131,3 +136,18 @@ Development of C code is done in Eclipse.
131136
4. Set environment variable `PYTHONVER` to the python version you want to build, i.e.: ` export PYTHONVER=3.6`
132137
5. In `<Repository>/c/` execute `make`.
133138

139+
140+
## Mac OS X
141+
142+
1. Install Python 3.6 and gcc compiler.
143+
2. Set `GLOBALS_HOME` environment variable to the root of Caché or Ensemble installation.
144+
3. Set environment variable `PYTHONVER` to the python version you want to build, i.e.: ` export PYTHONVER=3.6`
145+
2. In `<Repository>/c/` execute:
146+
147+
```
148+
gcc -Wall -Wextra -fpic -O3 -fno-strict-aliasing -Wno-unused-parameter -I/Library/Frameworks/Python.framework/Versions/${PYTHONVER}/Headers -I${GLOBALS_HOME}/dev/iris-callin/include -c -o iscpython.o iscpython.c
149+
150+
gcc -dynamiclib -L/Library/Frameworks/Python.framework/Versions/${PYTHONVER}/lib -L/usr/lib -lpython3.6m -lpthread -ldl -lutil -lm -Xlinker iscpython.o -o iscpython.dylib
151+
```
152+
153+
If you have a Mac please update makefile so we can build Mac version via Make.

0 commit comments

Comments
 (0)