|
23 | 23 | "import requests\n",
|
24 | 24 | "from requests.auth import HTTPDigestAuth\n",
|
25 | 25 | "\n",
|
| 26 | + "# The App-Services app server in your MarkLogic instance is assumed to be on port 8000 and to require either 'digest' \n", |
| 27 | + "# or 'digestbasic' authentication. If the app server uses a different kind of authentication, you will need to modify \n", |
| 28 | + "# the two lines below that set the 'auth' fields for the admin and user sessions. The 'admin_session' is also used to \n", |
| 29 | + "# connect to the MarkLogic Manage app server on port 8002, so the authentication strategy should be the same for the \n", |
| 30 | + "# Manage and App-Services app servers.\n", |
| 31 | + "\n", |
26 | 32 | "admin_session = requests.Session()\n",
|
27 | 33 | "admin_session.auth = HTTPDigestAuth(adminUser, adminPassword)\n",
|
28 | 34 | "\n",
|
|
221 | 227 | "# Retrieve employees as JSON rows using an Optic query, printing the response from MarkLogic.\n",
|
222 | 228 | "# See https://docs.marklogic.com/11.0/guide/optic-guide/en/getting-started-with-optic.html for more information.\n",
|
223 | 229 | "\n",
|
| 230 | + "# If you run this and receive a \"SQL-TABLEREINDEXING\" error, that is simply because MarkLogic is still indexing the \n", |
| 231 | + "# table that was created in the previous cell. Wait a few seconds and then try running the cell again.\n", |
| 232 | + "\n", |
224 | 233 | "optic_query = 'op.fromView(\"example\", \"employee\").where(op.eq(op.col(\"City\"), \"San Jose\"))'\n",
|
225 | 234 | "r = user_session.post(\n",
|
226 | 235 | " f'{base_url}:8000/v1/rows?column-types=header', \n",
|
|
243 | 252 | "source": [
|
244 | 253 | "# Retrieve employees as CSV data and create a pandas DataFrame.\n",
|
245 | 254 | "\n",
|
| 255 | + "# The line below will install pandas; you can remove it if your Python environment already has pandas installed. If you \n", |
| 256 | + "# leave it in, you can also ignore any warnings that appear about needing to restart the Jupyter kernel.\n", |
246 | 257 | "%pip install pandas\n",
|
| 258 | + "\n", |
247 | 259 | "import pandas as pd\n",
|
248 | 260 | "import io\n",
|
249 | 261 | "\n",
|
|
0 commit comments