|
40 | 40 | "The following cell sets up the connection to the database for the Jupyter SQL Magic." |
41 | 41 | ] |
42 | 42 | }, |
43 | | - { |
44 | | - "cell_type": "markdown", |
45 | | - "metadata": {}, |
46 | | - "source": [] |
47 | | - }, |
48 | 43 | { |
49 | 44 | "cell_type": "code", |
50 | 45 | "execution_count": null, |
|
76 | 71 | "%sql mysql+pymysql://dev:devpass@db" |
77 | 72 | ] |
78 | 73 | }, |
79 | | - { |
80 | | - "cell_type": "markdown", |
81 | | - "metadata": {}, |
82 | | - "source": [ |
83 | | - "# Connect with DataJoint \n", |
84 | | - "\n", |
85 | | - "\n", |
86 | | - "\n", |
87 | | - "The DataJoint client library uses these environment variables to connect to the database.\n", |
88 | | - "It sufficient to simply import the datajoint client library.\n", |
89 | | - "It will connect to the database automatically as soon as necessary.\n", |
90 | | - "However, you can explicity verify the connection by calling `dj.conn()`:" |
91 | | - ] |
92 | | - }, |
93 | | - { |
94 | | - "cell_type": "code", |
95 | | - "execution_count": 1, |
96 | | - "metadata": {}, |
97 | | - "outputs": [ |
98 | | - { |
99 | | - "name": "stderr", |
100 | | - "output_type": "stream", |
101 | | - "text": [ |
102 | | - "[2025-09-16 01:37:46,977][INFO]: DataJoint 0.14.6 connected to dev@db:3306\n" |
103 | | - ] |
104 | | - }, |
105 | | - { |
106 | | - "data": { |
107 | | - "text/plain": [ |
108 | | - "DataJoint connection (connected) dev@db:3306" |
109 | | - ] |
110 | | - }, |
111 | | - "execution_count": 1, |
112 | | - "metadata": {}, |
113 | | - "output_type": "execute_result" |
114 | | - } |
115 | | - ], |
116 | | - "source": [ |
117 | | - "import datajoint as dj\n", |
118 | | - "dj.conn() # test the connection (optionally)" |
119 | | - ] |
120 | | - }, |
121 | | - { |
122 | | - "cell_type": "markdown", |
123 | | - "metadata": {}, |
124 | | - "source": [ |
125 | | - "If you are only learning DataJoint, you are done.\n", |
126 | | - "If you are reading this text to also learn SQL, you can use two ways to issue queries: with IPython magic commands or a client library." |
127 | | - ] |
128 | | - }, |
129 | | - { |
130 | | - "cell_type": "markdown", |
131 | | - "metadata": {}, |
132 | | - "source": [ |
133 | | - "If you are only learning DataJoint, you are done.\n", |
134 | | - "If you are reading this text to also learn SQL, you can use two ways to issue queries: with IPython magic commands or a client library." |
135 | | - ] |
136 | | - }, |
137 | 74 | { |
138 | 75 | "cell_type": "markdown", |
139 | 76 | "metadata": {}, |
|
230 | 167 | "SELECT User FROM mysql.user" |
231 | 168 | ] |
232 | 169 | }, |
| 170 | + { |
| 171 | + "cell_type": "markdown", |
| 172 | + "metadata": {}, |
| 173 | + "source": [ |
| 174 | + "# Connect with DataJoint \n", |
| 175 | + "\n", |
| 176 | + "\n", |
| 177 | + "\n", |
| 178 | + "The DataJoint client library uses these environment variables to connect to the database.\n", |
| 179 | + "It sufficient to simply import the datajoint client library.\n", |
| 180 | + "It will connect to the database automatically as soon as necessary.\n", |
| 181 | + "However, you can explicity verify the connection by calling `dj.conn()`:" |
| 182 | + ] |
| 183 | + }, |
| 184 | + { |
| 185 | + "cell_type": "code", |
| 186 | + "execution_count": 1, |
| 187 | + "metadata": {}, |
| 188 | + "outputs": [ |
| 189 | + { |
| 190 | + "name": "stderr", |
| 191 | + "output_type": "stream", |
| 192 | + "text": [ |
| 193 | + "[2025-09-16 01:37:46,977][INFO]: DataJoint 0.14.6 connected to dev@db:3306\n" |
| 194 | + ] |
| 195 | + }, |
| 196 | + { |
| 197 | + "data": { |
| 198 | + "text/plain": [ |
| 199 | + "DataJoint connection (connected) dev@db:3306" |
| 200 | + ] |
| 201 | + }, |
| 202 | + "execution_count": 1, |
| 203 | + "metadata": {}, |
| 204 | + "output_type": "execute_result" |
| 205 | + } |
| 206 | + ], |
| 207 | + "source": [ |
| 208 | + "import datajoint as dj\n", |
| 209 | + "dj.conn() # test the connection (optionally)" |
| 210 | + ] |
| 211 | + }, |
233 | 212 | { |
234 | 213 | "cell_type": "markdown", |
235 | 214 | "metadata": {}, |
|
0 commit comments