|
12 | 12 | ] |
13 | 13 | }, |
14 | 14 | { |
15 | | - "cell_type": "markdown", |
| 15 | + "cell_type": "code", |
| 16 | + "execution_count": 1, |
| 17 | + "metadata": {}, |
| 18 | + "outputs": [ |
| 19 | + { |
| 20 | + "name": "stderr", |
| 21 | + "output_type": "stream", |
| 22 | + "text": [ |
| 23 | + "[2023-10-02 01:53:59,830][INFO]: Connecting root@fakeservices.datajoint.io:3306\n", |
| 24 | + "[2023-10-02 01:53:59,836][INFO]: Connected root@fakeservices.datajoint.io:3306\n" |
| 25 | + ] |
| 26 | + }, |
| 27 | + { |
| 28 | + "data": { |
| 29 | + "image/svg+xml": [ |
| 30 | + "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"187pt\" height=\"185pt\" viewBox=\"0.00 0.00 187.00 185.00\">\n", |
| 31 | + "<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 181)\">\n", |
| 32 | + "<title>%3</title>\n", |
| 33 | + "<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-181 183,-181 183,4 -4,4\"/>\n", |
| 34 | + "<!-- AddOn -->\n", |
| 35 | + "<g id=\"node1\" class=\"node\">\n", |
| 36 | + "<title>AddOn</title>\n", |
| 37 | + "<g id=\"a_node1\"><a xlink:title=\"addon_id \r------------------------------\raddon_name \rprice \r\">\n", |
| 38 | + "<polygon fill=\"#000000\" fill-opacity=\"0.125490\" stroke=\"transparent\" points=\"47,-106 0,-106 0,-71 47,-71 47,-106\"/>\n", |
| 39 | + "<text text-anchor=\"start\" x=\"8\" y=\"-87\" font-family=\"arial\" text-decoration=\"underline\" font-size=\"10.00\">AddOn</text>\n", |
| 40 | + "</a>\n", |
| 41 | + "</g>\n", |
| 42 | + "</g>\n", |
| 43 | + "<!-- Purchase -->\n", |
| 44 | + "<g id=\"node3\" class=\"node\">\n", |
| 45 | + "<title>Purchase</title>\n", |
| 46 | + "<g id=\"a_node3\"><a xlink:title=\"→ Account\r→ AddOn\r------------------------------\r→ CreditCard\r\">\n", |
| 47 | + "<polygon fill=\"#00ff00\" fill-opacity=\"0.188235\" stroke=\"#00ff00\" stroke-opacity=\"0.188235\" points=\"109.5,-35 41.5,-35 41.5,0 109.5,0 109.5,-35\"/>\n", |
| 48 | + "<text text-anchor=\"middle\" x=\"75.5\" y=\"-14.4\" font-family=\"arial\" font-size=\"12.00\" fill=\"darkgreen\">Purchase</text>\n", |
| 49 | + "</a>\n", |
| 50 | + "</g>\n", |
| 51 | + "</g>\n", |
| 52 | + "<!-- AddOn->Purchase -->\n", |
| 53 | + "<g id=\"edge1\" class=\"edge\">\n", |
| 54 | + "<title>AddOn->Purchase</title>\n", |
| 55 | + "<path fill=\"none\" stroke=\"#000000\" stroke-width=\"0.75\" stroke-opacity=\"0.250980\" d=\"M36.09,-70.8C44.26,-59.95 54.88,-45.87 63.03,-35.05\"/>\n", |
| 56 | + "</g>\n", |
| 57 | + "<!-- Account -->\n", |
| 58 | + "<g id=\"node2\" class=\"node\">\n", |
| 59 | + "<title>Account</title>\n", |
| 60 | + "<g id=\"a_node2\"><a xlink:title=\"phone \r------------------------------\rfirst_name \rlast_name \rdob=null \rsex="" \r\">\n", |
| 61 | + "<polygon fill=\"#00ff00\" fill-opacity=\"0.188235\" stroke=\"#00ff00\" stroke-opacity=\"0.188235\" points=\"138.5,-177 78.5,-177 78.5,-142 138.5,-142 138.5,-177\"/>\n", |
| 62 | + "<text text-anchor=\"start\" x=\"86.5\" y=\"-157.4\" font-family=\"arial\" text-decoration=\"underline\" font-size=\"12.00\" fill=\"darkgreen\">Account</text>\n", |
| 63 | + "</a>\n", |
| 64 | + "</g>\n", |
| 65 | + "</g>\n", |
| 66 | + "<!-- Account->Purchase -->\n", |
| 67 | + "<g id=\"edge2\" class=\"edge\">\n", |
| 68 | + "<title>Account->Purchase</title>\n", |
| 69 | + "<path fill=\"none\" stroke=\"#000000\" stroke-width=\"0.75\" stroke-opacity=\"0.250980\" d=\"M104.33,-141.97C101.74,-131.64 98.37,-118.06 95.5,-106 89.65,-81.44 83.2,-52.93 79.24,-35.3\"/>\n", |
| 70 | + "</g>\n", |
| 71 | + "<!-- CreditCard -->\n", |
| 72 | + "<g id=\"node4\" class=\"node\">\n", |
| 73 | + "<title>CreditCard</title>\n", |
| 74 | + "<g id=\"a_node4\"><a xlink:title=\"card_number \r------------------------------\rexp_date \rcvv \rzipcode \r→ Account\r\">\n", |
| 75 | + "<polygon fill=\"#00ff00\" fill-opacity=\"0.188235\" stroke=\"#00ff00\" stroke-opacity=\"0.188235\" points=\"179,-106 104,-106 104,-71 179,-71 179,-106\"/>\n", |
| 76 | + "<text text-anchor=\"start\" x=\"112\" y=\"-86.4\" font-family=\"arial\" text-decoration=\"underline\" font-size=\"12.00\" fill=\"darkgreen\">CreditCard</text>\n", |
| 77 | + "</a>\n", |
| 78 | + "</g>\n", |
| 79 | + "</g>\n", |
| 80 | + "<!-- Account->CreditCard -->\n", |
| 81 | + "<g id=\"edge3\" class=\"edge\">\n", |
| 82 | + "<title>Account->CreditCard</title>\n", |
| 83 | + "<path fill=\"none\" stroke=\"#000000\" stroke-width=\"0.75\" stroke-dasharray=\"5,2\" stroke-opacity=\"0.250980\" d=\"M116.49,-141.8C121.68,-130.95 128.41,-116.87 133.59,-106.05\"/>\n", |
| 84 | + "</g>\n", |
| 85 | + "<!-- CreditCard->Purchase -->\n", |
| 86 | + "<g id=\"edge4\" class=\"edge\">\n", |
| 87 | + "<title>CreditCard->Purchase</title>\n", |
| 88 | + "<path fill=\"none\" stroke=\"#000000\" stroke-width=\"0.75\" stroke-dasharray=\"5,2\" stroke-opacity=\"0.250980\" d=\"M125.52,-70.8C115.15,-59.95 101.68,-45.87 91.33,-35.05\"/>\n", |
| 89 | + "</g>\n", |
| 90 | + "</g>\n", |
| 91 | + "</svg>" |
| 92 | + ], |
| 93 | + "text/plain": [ |
| 94 | + "<datajoint.diagram.Diagram at 0x7f40890cb940>" |
| 95 | + ] |
| 96 | + }, |
| 97 | + "execution_count": 1, |
| 98 | + "metadata": {}, |
| 99 | + "output_type": "execute_result" |
| 100 | + } |
| 101 | + ], |
| 102 | + "source": [ |
| 103 | + "import datajoint as dj\n", |
| 104 | + "schema = dj.Schema('app')\n", |
| 105 | + "schema.spawn_missing_classes()\n", |
| 106 | + "dj.Diagram(schema)" |
| 107 | + ] |
| 108 | + }, |
| 109 | + { |
| 110 | + "cell_type": "code", |
| 111 | + "execution_count": 13, |
| 112 | + "metadata": {}, |
| 113 | + "outputs": [ |
| 114 | + { |
| 115 | + "data": { |
| 116 | + "text/html": [ |
| 117 | + "\n", |
| 118 | + " \n", |
| 119 | + " <style type=\"text/css\">\n", |
| 120 | + " .Table{\n", |
| 121 | + " border-collapse:collapse;\n", |
| 122 | + " }\n", |
| 123 | + " .Table th{\n", |
| 124 | + " background: #A0A0A0; color: #ffffff; padding:4px; border:#f0e0e0 1px solid;\n", |
| 125 | + " font-weight: normal; font-family: monospace; font-size: 100%;\n", |
| 126 | + " }\n", |
| 127 | + " .Table td{\n", |
| 128 | + " padding:4px; border:#f0e0e0 1px solid; font-size:100%;\n", |
| 129 | + " }\n", |
| 130 | + " .Table tr:nth-child(odd){\n", |
| 131 | + " background: #ffffff;\n", |
| 132 | + " color: #000000;\n", |
| 133 | + " }\n", |
| 134 | + " .Table tr:nth-child(even){\n", |
| 135 | + " background: #f3f1ff;\n", |
| 136 | + " color: #000000;\n", |
| 137 | + " }\n", |
| 138 | + " /* Tooltip container */\n", |
| 139 | + " .djtooltip {\n", |
| 140 | + " }\n", |
| 141 | + " /* Tooltip text */\n", |
| 142 | + " .djtooltip .djtooltiptext {\n", |
| 143 | + " visibility: hidden;\n", |
| 144 | + " width: 120px;\n", |
| 145 | + " background-color: black;\n", |
| 146 | + " color: #fff;\n", |
| 147 | + " text-align: center;\n", |
| 148 | + " padding: 5px 0;\n", |
| 149 | + " border-radius: 6px;\n", |
| 150 | + " /* Position the tooltip text - see examples below! */\n", |
| 151 | + " position: absolute;\n", |
| 152 | + " z-index: 1;\n", |
| 153 | + " }\n", |
| 154 | + " #primary {\n", |
| 155 | + " font-weight: bold;\n", |
| 156 | + " color: black;\n", |
| 157 | + " }\n", |
| 158 | + " #nonprimary {\n", |
| 159 | + " font-weight: normal;\n", |
| 160 | + " color: white;\n", |
| 161 | + " }\n", |
| 162 | + "\n", |
| 163 | + " /* Show the tooltip text when you mouse over the tooltip container */\n", |
| 164 | + " .djtooltip:hover .djtooltiptext {\n", |
| 165 | + " visibility: visible;\n", |
| 166 | + " }\n", |
| 167 | + " </style>\n", |
| 168 | + " \n", |
| 169 | + " <b></b>\n", |
| 170 | + " <div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n", |
| 171 | + " <table border=\"1\" class=\"Table\">\n", |
| 172 | + " <thead> <tr style=\"text-align: right;\"> <th> <div class=\"djtooltip\">\n", |
| 173 | + " <p id=\"primary\">phone</p>\n", |
| 174 | + " <span class=\"djtooltiptext\"></span>\n", |
| 175 | + " </div></th><th><div class=\"djtooltip\">\n", |
| 176 | + " <p id=\"nonprimary\">first_name</p>\n", |
| 177 | + " <span class=\"djtooltiptext\"></span>\n", |
| 178 | + " </div></th><th><div class=\"djtooltip\">\n", |
| 179 | + " <p id=\"nonprimary\">last_name</p>\n", |
| 180 | + " <span class=\"djtooltiptext\"></span>\n", |
| 181 | + " </div></th><th><div class=\"djtooltip\">\n", |
| 182 | + " <p id=\"nonprimary\">dob</p>\n", |
| 183 | + " <span class=\"djtooltiptext\"></span>\n", |
| 184 | + " </div></th><th><div class=\"djtooltip\">\n", |
| 185 | + " <p id=\"nonprimary\">sex</p>\n", |
| 186 | + " <span class=\"djtooltiptext\"></span>\n", |
| 187 | + " </div> </th> </tr> </thead>\n", |
| 188 | + " <tbody> <tr> <td>10119628924</td>\n", |
| 189 | + "<td>Paul</td>\n", |
| 190 | + "<td>King</td>\n", |
| 191 | + "<td>2014-03-10</td>\n", |
| 192 | + "<td>M</td></tr><tr><td>10654544184</td>\n", |
| 193 | + "<td>Paula</td>\n", |
| 194 | + "<td>Gibson</td>\n", |
| 195 | + "<td>1964-06-17</td>\n", |
| 196 | + "<td>F</td></tr><tr><td>12623996456</td>\n", |
| 197 | + "<td>Paul</td>\n", |
| 198 | + "<td>Davis</td>\n", |
| 199 | + "<td>1941-10-02</td>\n", |
| 200 | + "<td>M</td></tr><tr><td>13045495630</td>\n", |
| 201 | + "<td>Paul</td>\n", |
| 202 | + "<td>Page</td>\n", |
| 203 | + "<td>1966-01-29</td>\n", |
| 204 | + "<td>M</td></tr><tr><td>15260885919</td>\n", |
| 205 | + "<td>Paula</td>\n", |
| 206 | + "<td>Moreno</td>\n", |
| 207 | + "<td>1920-09-12</td>\n", |
| 208 | + "<td>F</td></tr><tr><td>15411070504</td>\n", |
| 209 | + "<td>Paul</td>\n", |
| 210 | + "<td>Freeman</td>\n", |
| 211 | + "<td>2022-05-06</td>\n", |
| 212 | + "<td>M</td></tr><tr><td>17893838071</td>\n", |
| 213 | + "<td>Paula</td>\n", |
| 214 | + "<td>Patel</td>\n", |
| 215 | + "<td>1964-05-08</td>\n", |
| 216 | + "<td>F</td></tr><tr><td>18771323137</td>\n", |
| 217 | + "<td>Paul</td>\n", |
| 218 | + "<td>Alvarado</td>\n", |
| 219 | + "<td>1947-11-18</td>\n", |
| 220 | + "<td>M</td></tr><tr><td>18904286829</td>\n", |
| 221 | + "<td>Paul</td>\n", |
| 222 | + "<td>Kelly</td>\n", |
| 223 | + "<td>2017-05-25</td>\n", |
| 224 | + "<td>M</td></tr><tr><td>19461966017</td>\n", |
| 225 | + "<td>Paul</td>\n", |
| 226 | + "<td>Guzman</td>\n", |
| 227 | + "<td>1926-05-26</td>\n", |
| 228 | + "<td>M</td></tr><tr><td>21025887328</td>\n", |
| 229 | + "<td>Paul</td>\n", |
| 230 | + "<td>Frazier</td>\n", |
| 231 | + "<td>1954-08-22</td>\n", |
| 232 | + "<td>M</td></tr><tr><td>22726453483</td>\n", |
| 233 | + "<td>Paula</td>\n", |
| 234 | + "<td>Ray</td>\n", |
| 235 | + "<td>2014-01-12</td>\n", |
| 236 | + "<td>F</td> </tr> </tbody>\n", |
| 237 | + " </table>\n", |
| 238 | + " <p>...</p>\n", |
| 239 | + " <p>Total: 63</p></div>\n", |
| 240 | + " " |
| 241 | + ], |
| 242 | + "text/plain": [ |
| 243 | + "*phone first_name last_name dob sex \n", |
| 244 | + "+------------+ +------------+ +-----------+ +------------+ +-----+\n", |
| 245 | + "10119628924 Paul King 2014-03-10 M \n", |
| 246 | + "10654544184 Paula Gibson 1964-06-17 F \n", |
| 247 | + "12623996456 Paul Davis 1941-10-02 M \n", |
| 248 | + "13045495630 Paul Page 1966-01-29 M \n", |
| 249 | + "15260885919 Paula Moreno 1920-09-12 F \n", |
| 250 | + "15411070504 Paul Freeman 2022-05-06 M \n", |
| 251 | + "17893838071 Paula Patel 1964-05-08 F \n", |
| 252 | + "18771323137 Paul Alvarado 1947-11-18 M \n", |
| 253 | + "18904286829 Paul Kelly 2017-05-25 M \n", |
| 254 | + "19461966017 Paul Guzman 1926-05-26 M \n", |
| 255 | + "21025887328 Paul Frazier 1954-08-22 M \n", |
| 256 | + "22726453483 Paula Ray 2014-01-12 F \n", |
| 257 | + " ...\n", |
| 258 | + " (Total: 63)" |
| 259 | + ] |
| 260 | + }, |
| 261 | + "execution_count": 13, |
| 262 | + "metadata": {}, |
| 263 | + "output_type": "execute_result" |
| 264 | + } |
| 265 | + ], |
| 266 | + "source": [ |
| 267 | + "# Problem 1 (solved). All accounts last_names for persons named \"Paul\" or \"Paula\"\n", |
| 268 | + "Account & 'first_name in (\"Paul\", \"Paula\")'" |
| 269 | + ] |
| 270 | + }, |
| 271 | + { |
| 272 | + "cell_type": "code", |
| 273 | + "execution_count": null, |
16 | 274 | "metadata": {}, |
17 | | - "source": [] |
| 275 | + "outputs": [], |
| 276 | + "source": [ |
| 277 | + "# # Problem 2 (solved). All last_names for persons named \"Paul\" or \"Paula\", ordered by dob\n" |
| 278 | + ] |
18 | 279 | } |
19 | 280 | ], |
20 | 281 | "metadata": { |
| 282 | + "kernelspec": { |
| 283 | + "display_name": "Python 3", |
| 284 | + "language": "python", |
| 285 | + "name": "python3" |
| 286 | + }, |
21 | 287 | "language_info": { |
22 | | - "name": "python" |
| 288 | + "codemirror_mode": { |
| 289 | + "name": "ipython", |
| 290 | + "version": 3 |
| 291 | + }, |
| 292 | + "file_extension": ".py", |
| 293 | + "mimetype": "text/x-python", |
| 294 | + "name": "python", |
| 295 | + "nbconvert_exporter": "python", |
| 296 | + "pygments_lexer": "ipython3", |
| 297 | + "version": "3.9.17" |
23 | 298 | }, |
24 | 299 | "orig_nbformat": 4 |
25 | 300 | }, |
|
0 commit comments