Skip to content

Commit 67bdfd1

Browse files
committed
demo Jupiter Notebook added
1 parent 59502f4 commit 67bdfd1

File tree

2 files changed

+108
-1
lines changed

2 files changed

+108
-1
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ env
33
.pytest_cache
44
build
55
dist
6-
*.egg-info
6+
*.egg-info
7+
__pycache__

iris.ipynb

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": [
9+
"!pip install testcontainers-iris\n",
10+
"!pip install sqlalchemy-iris"
11+
]
12+
},
13+
{
14+
"cell_type": "code",
15+
"execution_count": 17,
16+
"metadata": {},
17+
"outputs": [
18+
{
19+
"name": "stderr",
20+
"output_type": "stream",
21+
"text": [
22+
"Pulling image containers.intersystems.com/intersystems/iris-community:2023.3\n",
23+
"Container started: 1d5baa884e0d\n",
24+
"Waiting to be ready...\n",
25+
"Waiting to be ready...\n"
26+
]
27+
},
28+
{
29+
"name": "stdout",
30+
"output_type": "stream",
31+
"text": [
32+
"SQLAlchemy URL iris://demo:demo@localhost:65126/demo\n",
33+
"Management Portal http://localhost:65127/csp/sys/UtilHome.csp\n",
34+
"Username demo\n",
35+
"Password demo\n"
36+
]
37+
}
38+
],
39+
"source": [
40+
"from testcontainers.iris import IRISContainer\n",
41+
"\n",
42+
"container = IRISContainer('containers.intersystems.com/intersystems/iris-community:2023.3', username=\"demo\", password=\"demo\", namespace=\"demo\")\n",
43+
"container.with_exposed_ports(1972, 52773)\n",
44+
"container.start()\n",
45+
"print('SQLAlchemy URL', container.get_connection_url())\n",
46+
"portal_url = f'http://localhost:{container.get_exposed_port(52773)}/csp/sys/UtilHome.csp'\n",
47+
"print('Management Portal', portal_url)\n",
48+
"print('Username', container.username)\n",
49+
"print('Password', container.password)"
50+
]
51+
},
52+
{
53+
"cell_type": "code",
54+
"execution_count": 18,
55+
"metadata": {},
56+
"outputs": [
57+
{
58+
"name": "stderr",
59+
"output_type": "stream",
60+
"text": [
61+
"Waiting to be ready...\n"
62+
]
63+
},
64+
{
65+
"data": {
66+
"text/plain": [
67+
"[('IRIS for UNIX (Ubuntu Server LTS for ARM64 Containers) 2023.3 (Build 254U) Wed Nov 8 2023 13:04:07 EST', 'demo', 'DEMO')]"
68+
]
69+
},
70+
"execution_count": 18,
71+
"metadata": {},
72+
"output_type": "execute_result"
73+
}
74+
],
75+
"source": [
76+
"from sqlalchemy import create_engine, text\n",
77+
"engine = create_engine(container.get_connection_url())\n",
78+
"\n",
79+
"conn = engine.connect()\n",
80+
"res = conn.execute(text(\"select $zversion, $username, $namespace\"))\n",
81+
"res.fetchall()\n"
82+
]
83+
}
84+
],
85+
"metadata": {
86+
"kernelspec": {
87+
"display_name": "Python 3",
88+
"language": "python",
89+
"name": "python3"
90+
},
91+
"language_info": {
92+
"codemirror_mode": {
93+
"name": "ipython",
94+
"version": 3
95+
},
96+
"file_extension": ".py",
97+
"mimetype": "text/x-python",
98+
"name": "python",
99+
"nbconvert_exporter": "python",
100+
"pygments_lexer": "ipython3",
101+
"version": "3.11.4"
102+
}
103+
},
104+
"nbformat": 4,
105+
"nbformat_minor": 2
106+
}

0 commit comments

Comments
 (0)