You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As you can see it creates dabasases IRISAPP_DATA and IRISAPP_CODE for data and code, the related IRISAPP namespace to access it and the related resources %IRISAPP_DATA and %IRISAPP_CODE" to manage the access.
75
+
76
+
Also it enables Callin service to make Embedded python work via ModifyService clause.
77
+
and it updates the password for the built-in user SuperUser to "SYS". The hash for this password is obtained via the following command:
78
+
```bash
79
+
docker run --rm -it containers.intersystems.com/intersystems/passwordhash:1.1 -algorithm SHA512 -workfactor 10000
80
+
```
81
+
82
+
2. Using python to initialize IRIS.
83
+
Often we used a special iris.script file to run ObjectScript commands during the initialization.
84
+
This template shows you how to use python for the same purpose.
85
+
It is being executed via the line in Dockerfile:
86
+
```
87
+
irispython iris-script.py && \
88
+
```
89
+
the iris-script.py file contains examples how developer can initialize different services of iris via Python code.
90
+
91
+
55
92
## How to test it
56
93
57
94
### Working with Python libs from ObjectScript
@@ -88,18 +125,10 @@ As mentioned Embedded Python works in the **same process as IRIS**.
88
125
89
126
So you have 2 options to work with Embedded Python in IRIS:
90
127
91
-
1. Bind VsCode to the running IRIS container.
92
-
2. Develop in VSCode locally and then run the code in IRIS container with a shared folder.
93
-
94
-
#### Bind VSCode to the running IRIS container
95
-
96
-
Open VSCode in the project directory.
97
-
98
-
Go to the `docker-compose.yml` file, right-click on it and select `Compose Up`.
99
-
100
-
Once the container is up and running you can open the docker extension and right-click on the container name and select `Attach Visual Studio Code`.
128
+
1. Develop in VSCode locally and then run the code in IRIS container with a shared folder.
129
+
2. Bind VsCode to the running IRIS container.
101
130
102
-
####Develop locally and run the code in IRIS container
131
+
### Develop python scripts locally and run the code in IRIS container
103
132
104
133
By default, the template is configured to use the shared folder `./src` for python scripts to `/home/irisowner/dev/src` in IRIS container.
105
134
@@ -121,15 +150,52 @@ Install the requirements:
121
150
$ pip install -r requirements.txt
122
151
```
123
152
124
-
Run the python script:
153
+
#### Run the python script in iris container:
125
154
126
155
```bash
127
156
# attach to the running IRIS container
128
157
docker-compose exec iris bash
129
158
# run the script
130
159
$ irispython ./python/irisapp.py
131
160
```
161
+
The script contains different samples of working with IRIS from python and goes through it.
162
+
it should return something like this:
163
+
```
164
+
Hello World
165
+
Method call:
166
+
It works!
167
+
42
168
+
Iris Version:
169
+
IRIS for UNIX (Ubuntu Server LTS for ARM64 Containers) 2023.2 (Build 227U) Mon Jul 31 2023 17:43:25 EDT
170
+
Creating new record in dc.python.PersistentClass
171
+
1
172
+
Printing one IRIS Object Dump:
173
+
+----------------- general information ---------------
Running SQL query Select * from dc_python.PersistentClass
184
+
[0]: ['1', '2023-09-03 10:56:45.227577']
185
+
Printing the whole global of the persistence storage for the class dc.python.PersistentClass:^dc.Package4C8F.PersistentC1A93D
186
+
key=['1']: 2023-09-03 10:56:45.227577
187
+
James
188
+
Jim
189
+
John
190
+
```
132
191
192
+
#### Bind VSCode to the running IRIS container
193
+
194
+
Open VSCode in the project directory.
195
+
196
+
Go to the `docker-compose.yml` file, right-click on it and select `Compose Up`.
197
+
198
+
Once the container is up and running you can open the docker extension and right-click on the container name and select `Attach Visual Studio Code`.
133
199
134
200
#### Working with IRIS from Embedded Python
135
201
Open VSCode in Devcontainer - this is the bell(notifications) button in the left bottom corner, where you will see the suggestion to open VSCOde in DevContainer mode.
@@ -139,7 +205,6 @@ Once devcontainer is opened go to /python/irisapp.py and run it, either with Run
139
205
```bash
140
206
$ irispython /python/irisapp.py
141
207
```
142
-
The script contains different samples of working with IRIS from python and goes through it.
0 commit comments