{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Show Records" ] }, { "cell_type": "raw", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ ".. note::\n", "\n", " The ``show_`` endpoints are meant to be used by admins to build functionality into their metacatalog deployment. These endpoints are not really helpful for the end-user." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Help" ] }, { "cell_type": "raw", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ ".. autofunction:: metacatalog.api.show_records" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example" ] }, { "cell_type": "raw", "metadata": { "raw_mimetype": "text/restructuredtext" }, "source": [ ".. note::\n", "\n", " This endpoint is not meant to be used to load metadata from the database in a production scenario. You can use it for backups or during development. It will return the raw table contents. To actually use the metadata, use the ``metacatalog.models`` classes or the ``api.find_*`` endpoints." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from metacatalog import api\n", "\n", "session = api.connect_database()" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "scrolled": false }, "outputs": [ { "data": { "text/plain": [ "[{'id': 1,\n", " 'title': 'Sap Flow - Hohes Holz - Tree 022',\n", " 'abstract': 'Sap flow tree 022- 20mm- east',\n", " 'external_id': '212',\n", " 'location': '01010000006806F1811D0B4A4002452C62D8712640',\n", " 'geom': None,\n", " 'creation': None,\n", " 'end': None,\n", " 'version': 1,\n", " 'latest_version_id': None,\n", " 'comment': 'not yet converted',\n", " 'license_id': 2,\n", " 'variable_id': 14,\n", " 'datasource_id': 1,\n", " 'embargo': True,\n", " 'embargo_end': datetime.datetime(2022, 5, 15, 12, 43, 57, 712110),\n", " 'publication': datetime.datetime(2020, 5, 15, 12, 43, 57, 712195),\n", " 'lastUpdate': datetime.datetime(2020, 5, 15, 13, 17, 47, 540713)},\n", " {'id': 2,\n", " 'title': 'Sap Flow - Hohes Holz - Tree 022',\n", " 'abstract': 'Sap flow tree 022- 20mm- north-west',\n", " 'external_id': '214',\n", " 'location': '01010000006806F1811D0B4A4002452C62D8712640',\n", " 'geom': None,\n", " 'creation': None,\n", " 'end': None,\n", " 'version': 1,\n", " 'latest_version_id': None,\n", " 'comment': 'not yet converted',\n", " 'license_id': 2,\n", " 'variable_id': 14,\n", " 'datasource_id': 2,\n", " 'embargo': True,\n", " 'embargo_end': datetime.datetime(2022, 5, 15, 12, 43, 57, 749350),\n", " 'publication': datetime.datetime(2020, 5, 15, 12, 43, 57, 749407),\n", " 'lastUpdate': datetime.datetime(2020, 5, 15, 13, 17, 47, 565270)},\n", " {'id': 3,\n", " 'title': 'Sap Flow - Hohes Holz - Tree 029',\n", " 'abstract': 'Sap flow tree 029- 20mm- north',\n", " 'external_id': '246',\n", " 'location': '0101000000761C3F541A0B4A4099F04BFDBC712640',\n", " 'geom': None,\n", " 'creation': None,\n", " 'end': None,\n", " 'version': 1,\n", " 'latest_version_id': None,\n", " 'comment': 'not yet converted',\n", " 'license_id': 2,\n", " 'variable_id': 14,\n", " 'datasource_id': 3,\n", " 'embargo': True,\n", " 'embargo_end': datetime.datetime(2022, 5, 15, 12, 43, 57, 770584),\n", " 'publication': datetime.datetime(2020, 5, 15, 12, 43, 57, 770633),\n", " 'lastUpdate': datetime.datetime(2020, 5, 15, 13, 17, 47, 576064)},\n", " {'id': 4,\n", " 'title': 'Sap Flow - Hohes Holz - Tree 048',\n", " 'abstract': 'Sap flow tree 048- 20mm- north 2015',\n", " 'external_id': '269',\n", " 'location': '01010000008BA8893E1F0B4A400B24287E8C712640',\n", " 'geom': None,\n", " 'creation': None,\n", " 'end': None,\n", " 'version': 1,\n", " 'latest_version_id': None,\n", " 'comment': 'nan',\n", " 'license_id': 2,\n", " 'variable_id': 14,\n", " 'datasource_id': 4,\n", " 'embargo': True,\n", " 'embargo_end': datetime.datetime(2022, 5, 15, 12, 43, 57, 789248),\n", " 'publication': datetime.datetime(2020, 5, 15, 12, 43, 57, 789294),\n", " 'lastUpdate': datetime.datetime(2020, 5, 15, 13, 17, 47, 587474)},\n", " {'id': 5,\n", " 'title': 'Sap Flow - Hohes Holz - Tree 050',\n", " 'abstract': 'Sap flow tree 050- 20mm- east',\n", " 'external_id': '275',\n", " 'location': '0101000000C11DA8531E0B4A404A26A77686712640',\n", " 'geom': None,\n", " 'creation': None,\n", " 'end': None,\n", " 'version': 1,\n", " 'latest_version_id': None,\n", " 'comment': 'nan',\n", " 'license_id': 2,\n", " 'variable_id': 14,\n", " 'datasource_id': 5,\n", " 'embargo': True,\n", " 'embargo_end': datetime.datetime(2022, 5, 15, 12, 43, 57, 807256),\n", " 'publication': datetime.datetime(2020, 5, 15, 12, 43, 57, 807302),\n", " 'lastUpdate': datetime.datetime(2020, 5, 15, 13, 17, 47, 598154)},\n", " {'id': 6,\n", " 'title': 'Sap Flow - Hohes Holz - Tree 056',\n", " 'abstract': 'Sap flow tree 056- 20mm- north',\n", " 'external_id': '282',\n", " 'location': '01010000003FA7203F1B0B4A4036E50AEF72712640',\n", " 'geom': None,\n", " 'creation': None,\n", " 'end': None,\n", " 'version': 1,\n", " 'latest_version_id': None,\n", " 'comment': 'nan',\n", " 'license_id': 2,\n", " 'variable_id': 14,\n", " 'datasource_id': 6,\n", " 'embargo': True,\n", " 'embargo_end': datetime.datetime(2022, 5, 15, 12, 43, 57, 825347),\n", " 'publication': datetime.datetime(2020, 5, 15, 12, 43, 57, 825393),\n", " 'lastUpdate': datetime.datetime(2020, 5, 15, 13, 17, 47, 608043)},\n", " {'id': 7,\n", " 'title': 'Sap Flow - Hohes Holz - Tree 057',\n", " 'abstract': 'Sap flow tree 057- 20mm- north',\n", " 'external_id': '292',\n", " 'location': '01010000009335EA211A0B4A40D6743DD175712640',\n", " 'geom': None,\n", " 'creation': None,\n", " 'end': None,\n", " 'version': 1,\n", " 'latest_version_id': None,\n", " 'comment': 'nan',\n", " 'license_id': 2,\n", " 'variable_id': 14,\n", " 'datasource_id': 7,\n", " 'embargo': True,\n", " 'embargo_end': datetime.datetime(2022, 5, 15, 12, 43, 57, 844292),\n", " 'publication': datetime.datetime(2020, 5, 15, 12, 43, 57, 844339),\n", " 'lastUpdate': datetime.datetime(2020, 5, 15, 13, 17, 47, 618236)},\n", " {'id': 8,\n", " 'title': 'Sap Flow - Hohes Holz - Tree 058',\n", " 'abstract': 'Sap flow tree 058- 20mm- east-north-east',\n", " 'external_id': '306',\n", " 'location': '0101000000A46C91B41B0B4A40807EDFBF79712640',\n", " 'geom': None,\n", " 'creation': None,\n", " 'end': None,\n", " 'version': 1,\n", " 'latest_version_id': None,\n", " 'comment': 'nan',\n", " 'license_id': 2,\n", " 'variable_id': 14,\n", " 'datasource_id': 8,\n", " 'embargo': True,\n", " 'embargo_end': datetime.datetime(2022, 5, 15, 12, 43, 57, 863693),\n", " 'publication': datetime.datetime(2020, 5, 15, 12, 43, 57, 863740),\n", " 'lastUpdate': datetime.datetime(2020, 5, 15, 13, 17, 47, 627976)},\n", " {'id': 9,\n", " 'title': 'Sap Flow - Hohes Holz - Tree 106',\n", " 'abstract': 'Sap flow tree 106 - 20mm - east - commertial',\n", " 'external_id': '326',\n", " 'location': '0101000000A87004A9140B4A40B79C4B7155712640',\n", " 'geom': None,\n", " 'creation': None,\n", " 'end': None,\n", " 'version': 1,\n", " 'latest_version_id': None,\n", " 'comment': 'commertial sensor in 20mm depth',\n", " 'license_id': 2,\n", " 'variable_id': 14,\n", " 'datasource_id': 9,\n", " 'embargo': True,\n", " 'embargo_end': datetime.datetime(2022, 5, 15, 12, 43, 57, 884135),\n", " 'publication': datetime.datetime(2020, 5, 15, 12, 43, 57, 884185),\n", " 'lastUpdate': datetime.datetime(2020, 5, 15, 13, 17, 47, 637880)},\n", " {'id': 10,\n", " 'title': 'Sap Flow - Hohes Holz - Tree 108',\n", " 'abstract': 'Sap flow tree 108 - 20mm - east-north-east - commertial',\n", " 'external_id': '333',\n", " 'location': '0101000000D828EB37130B4A403C855CA967712640',\n", " 'geom': None,\n", " 'creation': None,\n", " 'end': None,\n", " 'version': 1,\n", " 'latest_version_id': None,\n", " 'comment': 'commertial sensor in 20mm depth',\n", " 'license_id': 2,\n", " 'variable_id': 14,\n", " 'datasource_id': 10,\n", " 'embargo': True,\n", " 'embargo_end': datetime.datetime(2022, 5, 15, 12, 43, 57, 904529),\n", " 'publication': datetime.datetime(2020, 5, 15, 12, 43, 57, 904578),\n", " 'lastUpdate': datetime.datetime(2020, 5, 15, 13, 17, 47, 647861)}]" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "api.show_records(session, table_name='entries', limit=10)" ] } ], "metadata": { "celltoolbar": "Raw Cell Format", "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.7" } }, "nbformat": 4, "nbformat_minor": 4 }