From 720929c9a6d87a6d9f5c52c67072bb8c0e40ac6d Mon Sep 17 00:00:00 2001 From: Cujowolf Date: Thu, 7 Dec 2023 13:10:02 -0600 Subject: [PATCH] Digital carbon staging verification workbook --- .../Polygon Digital Carbon - Verify.ipynb | 1450 +++++++++++++++++ 1 file changed, 1450 insertions(+) create mode 100644 verification/Polygon Digital Carbon - Verify.ipynb diff --git a/verification/Polygon Digital Carbon - Verify.ipynb b/verification/Polygon Digital Carbon - Verify.ipynb new file mode 100644 index 00000000..04b12e6f --- /dev/null +++ b/verification/Polygon Digital Carbon - Verify.ipynb @@ -0,0 +1,1450 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from subgrounds import Subgrounds\n", + "from subgrounds.subgraph.fieldpath import FieldPath\n", + "import pandas as pd\n", + "\n", + "sg = Subgrounds()\n", + "current = sg.load_subgraph('https://api.thegraph.com/subgraphs/name/klimadao/polygon-digital-carbon')\n", + "staging = sg.load_subgraph('https://api.thegraph.com/subgraphs/name/klimadao/staging-polygon-digital-carbon')\n", + "\n", + "number_records = 1000\n" + ] + }, + { + "cell_type": "code", + "execution_count": 49, + "metadata": {}, + "outputs": [], + "source": [ + "def get_all_query_fields(sg_query, derived_fields: list[str]) -> list[FieldPath]:\n", + " fields = sg_query.__dict__.keys()\n", + " fields = [item for item in fields if not item.startswith('_') and not item in derived_fields]\n", + " return [sg_query.__getattribute__(item) for item in fields]\n" + ] + }, + { + "cell_type": "code", + "execution_count": 50, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + "
\n", + "
" + ], + "text/plain": [ + "Empty DataFrame\n", + "Columns: []\n", + "Index: []" + ] + }, + "execution_count": 50, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Token entity\n", + "\n", + "derived_fields = []\n", + "\n", + "current_results = current.Query.tokens(\n", + " first=number_records,\n", + " orderBy=current.Token.id,\n", + " orderDirection='asc'\n", + ")\n", + "\n", + "df_current = sg.query_df(\n", + " get_all_query_fields(current_results, derived_fields)\n", + ")\n", + "\n", + "new_results = staging.Query.tokens(\n", + " first=number_records,\n", + " orderBy=staging.Token.id,\n", + " orderDirection='asc'\n", + ")\n", + "\n", + "df_new = sg.query_df(\n", + " get_all_query_fields(new_results, derived_fields)\n", + ")\n", + "\n", + "df_current.compare(df_new)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 51, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + "
\n", + "
" + ], + "text/plain": [ + "Empty DataFrame\n", + "Columns: []\n", + "Index: []" + ] + }, + "execution_count": 51, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Ecosystem entity\n", + "\n", + "derived_fields = []\n", + "\n", + "current_results = current.Query.ecosystems(\n", + " first=number_records,\n", + " orderBy=current.Ecosystem.id,\n", + " orderDirection='asc'\n", + ")\n", + "\n", + "df_current = sg.query_df(\n", + " get_all_query_fields(current_results, derived_fields)\n", + ")\n", + "\n", + "new_results = staging.Query.ecosystems(\n", + " first=number_records,\n", + " orderBy=staging.Ecosystem.id,\n", + " orderDirection='asc'\n", + ")\n", + "\n", + "df_new = sg.query_df(\n", + " get_all_query_fields(new_results, derived_fields)\n", + ")\n", + "\n", + "df_current.compare(df_new)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 52, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + "
\n", + "
" + ], + "text/plain": [ + "Empty DataFrame\n", + "Columns: []\n", + "Index: []" + ] + }, + "execution_count": 52, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Epoch entity\n", + "\n", + "derived_fields = []\n", + "\n", + "current_results = current.Query.epoches(\n", + " first=number_records,\n", + " orderBy=current.Epoch.id,\n", + " orderDirection='asc'\n", + ")\n", + "\n", + "df_current = sg.query_df(\n", + " get_all_query_fields(current_results, derived_fields)\n", + ")\n", + "\n", + "new_results = staging.Query.epoches(\n", + " first=number_records,\n", + " orderBy=staging.Epoch.id,\n", + " orderDirection='asc'\n", + ")\n", + "\n", + "df_new = sg.query_df(\n", + " get_all_query_fields(new_results, derived_fields)\n", + ")\n", + "\n", + "df_current.compare(df_new)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 53, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
carbonProjects_category
selfother
65Renewable Energy, Renewable EnergyRenewable Energy
155Renewable Energy, Renewable EnergyRenewable Energy
\n", + "
" + ], + "text/plain": [ + " carbonProjects_category \n", + " self other\n", + "65 Renewable Energy, Renewable Energy Renewable Energy\n", + "155 Renewable Energy, Renewable Energy Renewable Energy" + ] + }, + "execution_count": 53, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Carbon Project entity\n", + "\n", + "derived_fields = ['carbonCredits']\n", + "\n", + "current_results = current.Query.carbonProjects(\n", + " first=number_records,\n", + " orderBy=current.CarbonProject.id,\n", + " orderDirection='asc'\n", + ")\n", + "\n", + "df_current = sg.query_df(\n", + " get_all_query_fields(current_results, derived_fields)\n", + ")\n", + "\n", + "new_results = staging.Query.carbonProjects(\n", + " first=number_records,\n", + " orderBy=staging.CarbonProject.id,\n", + " orderDirection='asc'\n", + ")\n", + "\n", + "df_new = sg.query_df(\n", + " get_all_query_fields(new_results, derived_fields)\n", + ")\n", + "\n", + "df_current.compare(df_new)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 54, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
carbonCredits_project_category
selfother
51Renewable Energy, Renewable EnergyRenewable Energy
75Renewable Energy, Renewable EnergyRenewable Energy
377Renewable Energy, Renewable EnergyRenewable Energy
\n", + "
" + ], + "text/plain": [ + " carbonCredits_project_category \n", + " self other\n", + "51 Renewable Energy, Renewable Energy Renewable Energy\n", + "75 Renewable Energy, Renewable Energy Renewable Energy\n", + "377 Renewable Energy, Renewable Energy Renewable Energy" + ] + }, + "execution_count": 54, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Carbon Credit entity\n", + "\n", + "derived_fields = ['bridges','retires','poolBalances']\n", + "\n", + "current_results = current.Query.carbonCredits(\n", + " first=number_records,\n", + " orderBy=current.CarbonCredit.id,\n", + " orderDirection='asc'\n", + ")\n", + "\n", + "df_current = sg.query_df(\n", + " get_all_query_fields(current_results, derived_fields)\n", + ")\n", + "\n", + "new_results = staging.Query.carbonCredits(\n", + " first=number_records,\n", + " orderBy=staging.CarbonCredit.id,\n", + " orderDirection='asc'\n", + ")\n", + "\n", + "df_new = sg.query_df(\n", + " get_all_query_fields(new_results, derived_fields)\n", + ")\n", + "\n", + "df_current.compare(df_new)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 55, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + "
\n", + "
" + ], + "text/plain": [ + "Empty DataFrame\n", + "Columns: []\n", + "Index: []" + ] + }, + "execution_count": 55, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Carbon Credit Snapshot entity\n", + "\n", + "derived_fields = []\n", + "\n", + "current_results = current.Query.carbonCreditSnapshots(\n", + " first=number_records,\n", + " orderBy=current.CarbonCreditSnapshot.id,\n", + " orderDirection='asc'\n", + ")\n", + "\n", + "df_current = sg.query_df(\n", + " get_all_query_fields(current_results, derived_fields)\n", + ")\n", + "\n", + "new_results = staging.Query.carbonCreditSnapshots(\n", + " first=number_records,\n", + " orderBy=staging.CarbonCreditSnapshot.id,\n", + " orderDirection='asc'\n", + ")\n", + "\n", + "df_new = sg.query_df(\n", + " get_all_query_fields(new_results, derived_fields)\n", + ")\n", + "\n", + "df_current.compare(df_new)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 56, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + "
\n", + "
" + ], + "text/plain": [ + "Empty DataFrame\n", + "Columns: []\n", + "Index: []" + ] + }, + "execution_count": 56, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Bridge entity\n", + "\n", + "derived_fields = []\n", + "\n", + "current_results = current.Query.bridges(\n", + " first=number_records,\n", + " orderBy=current.Bridge.id,\n", + " orderDirection='asc'\n", + ")\n", + "\n", + "df_current = sg.query_df(\n", + " get_all_query_fields(current_results, derived_fields)\n", + ")\n", + "\n", + "new_results = staging.Query.bridges(\n", + " first=number_records,\n", + " orderBy=staging.Bridge.id,\n", + " orderDirection='asc'\n", + ")\n", + "\n", + "df_new = sg.query_df(\n", + " get_all_query_fields(current_results, derived_fields)\n", + ")\n", + "\n", + "df_current.compare(df_new)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 57, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + "
\n", + "
" + ], + "text/plain": [ + "Empty DataFrame\n", + "Columns: []\n", + "Index: []" + ] + }, + "execution_count": 57, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Crosschain Bridge entity\n", + "\n", + "derived_fields = []\n", + "\n", + "current_results = current.Query.crossChainBridges(\n", + " first=number_records,\n", + " orderBy=current.CrossChainBridge.id,\n", + " orderDirection='asc'\n", + ")\n", + "\n", + "df_current = sg.query_df(\n", + " get_all_query_fields(current_results, derived_fields)\n", + ")\n", + "\n", + "new_results = staging.Query.crossChainBridges(\n", + " first=number_records,\n", + " orderBy=staging.CrossChainBridge.id,\n", + " orderDirection='asc'\n", + ")\n", + "\n", + "df_new = sg.query_df(\n", + " get_all_query_fields(new_results, derived_fields)\n", + ")\n", + "\n", + "df_current.compare(df_new)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 58, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + "
\n", + "
" + ], + "text/plain": [ + "Empty DataFrame\n", + "Columns: []\n", + "Index: []" + ] + }, + "execution_count": 58, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Retire entity\n", + "\n", + "derived_fields = ['klimaRetire']\n", + "\n", + "current_results = current.Query.retires(\n", + " first=number_records,\n", + " orderBy=current.Retire.id,\n", + " orderDirection='asc'\n", + ")\n", + "\n", + "df_current = sg.query_df(\n", + " get_all_query_fields(current_results, derived_fields)\n", + ")\n", + "\n", + "new_results = staging.Query.retires(\n", + " first=number_records,\n", + " orderBy=staging.Retire.id,\n", + " orderDirection='asc'\n", + ")\n", + "\n", + "df_new = sg.query_df(\n", + " get_all_query_fields(new_results, derived_fields)\n", + ")\n", + "\n", + "df_current.compare(df_new)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 59, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + "
\n", + "
" + ], + "text/plain": [ + "Empty DataFrame\n", + "Columns: []\n", + "Index: []" + ] + }, + "execution_count": 59, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Klima Retire entity\n", + "\n", + "derived_fields = []\n", + "\n", + "current_results = current.Query.klimaRetires(\n", + " first=number_records,\n", + " orderBy=current.KlimaRetire.id,\n", + " orderDirection='asc'\n", + ")\n", + "\n", + "df_current = sg.query_df(\n", + " get_all_query_fields(current_results, derived_fields)\n", + ")\n", + "\n", + "new_results = staging.Query.klimaRetires(\n", + " first=number_records,\n", + " orderBy=staging.KlimaRetire.id,\n", + " orderDirection='asc'\n", + ")\n", + "\n", + "df_new = sg.query_df(\n", + " get_all_query_fields(new_results, derived_fields)\n", + ")\n", + "\n", + "df_current.compare(df_new)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 60, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + "
\n", + "
" + ], + "text/plain": [ + "Empty DataFrame\n", + "Columns: []\n", + "Index: []" + ] + }, + "execution_count": 60, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Toucan Batch entity\n", + "\n", + "derived_fields = []\n", + "\n", + "current_results = current.Query.toucanBatches(\n", + " first=number_records,\n", + " orderBy=current.ToucanBatch.id,\n", + " orderDirection='asc'\n", + ")\n", + "\n", + "df_current = sg.query_df(\n", + " get_all_query_fields(current_results, derived_fields)\n", + ")\n", + "\n", + "new_results = staging.Query.toucanBatches(\n", + " first=number_records,\n", + " orderBy=staging.ToucanBatch.id,\n", + " orderDirection='asc'\n", + ")\n", + "\n", + "df_new = sg.query_df(\n", + " get_all_query_fields(new_results, derived_fields)\n", + ")\n", + "\n", + "df_current.compare(df_new)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 61, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + "
\n", + "
" + ], + "text/plain": [ + "Empty DataFrame\n", + "Columns: []\n", + "Index: []" + ] + }, + "execution_count": 61, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Carbon Pool entity\n", + "\n", + "derived_fields = ['creditBalances', 'dailySnapshots','deposits','redeems']\n", + "\n", + "current_results = current.Query.carbonPools(\n", + " first=number_records,\n", + " orderBy=current.CarbonPool.id,\n", + " orderDirection='asc'\n", + ")\n", + "\n", + "df_current = sg.query_df(\n", + " get_all_query_fields(current_results, derived_fields)\n", + ")\n", + "\n", + "new_results = staging.Query.carbonPools(\n", + " first=number_records,\n", + " orderBy=staging.CarbonPool.id,\n", + " orderDirection='asc'\n", + ")\n", + "\n", + "df_new = sg.query_df(\n", + " get_all_query_fields(new_results, derived_fields)\n", + ")\n", + "\n", + "df_current.compare(df_new)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 62, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + "
\n", + "
" + ], + "text/plain": [ + "Empty DataFrame\n", + "Columns: []\n", + "Index: []" + ] + }, + "execution_count": 62, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Carbon Pool Daily Snapshot entity\n", + "\n", + "derived_fields = ['creditBalances','deposits','redeems']\n", + "\n", + "current_results = current.Query.carbonPoolDailySnapshots(\n", + " first=number_records,\n", + " orderBy=current.CarbonPoolDailySnapshot.id,\n", + " orderDirection='asc'\n", + ")\n", + "\n", + "df_current = sg.query_df(\n", + " get_all_query_fields(current_results, derived_fields)\n", + ")\n", + "\n", + "new_results = staging.Query.carbonPoolDailySnapshots(\n", + " first=number_records,\n", + " orderBy=staging.CarbonPoolDailySnapshot.id,\n", + " orderDirection='asc'\n", + ")\n", + "\n", + "df_new = sg.query_df(\n", + " get_all_query_fields(new_results, derived_fields)\n", + ")\n", + "\n", + "df_current.compare(df_new)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 63, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + "
\n", + "
" + ], + "text/plain": [ + "Empty DataFrame\n", + "Columns: []\n", + "Index: []" + ] + }, + "execution_count": 63, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Carbon Pool Credit Balance entity\n", + "\n", + "derived_fields = ['dailySnapshots']\n", + "\n", + "current_results = current.Query.carbonPoolCreditBalances(\n", + " first=number_records,\n", + " orderBy=current.CarbonPoolCreditBalance.id,\n", + " orderDirection='asc'\n", + ")\n", + "\n", + "df_current = sg.query_df(\n", + " get_all_query_fields(current_results, derived_fields)\n", + ")\n", + "\n", + "new_results = staging.Query.carbonPoolCreditBalances(\n", + " first=number_records,\n", + " orderBy=staging.CarbonPoolCreditBalance.id,\n", + " orderDirection='asc'\n", + ")\n", + "\n", + "df_new = sg.query_df(\n", + " get_all_query_fields(new_results, derived_fields)\n", + ")\n", + "\n", + "df_current.compare(df_new)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 64, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + "
\n", + "
" + ], + "text/plain": [ + "Empty DataFrame\n", + "Columns: []\n", + "Index: []" + ] + }, + "execution_count": 64, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Carbon Pool Credit Balance Daily Snapshot entity\n", + "\n", + "derived_fields = ['deposits','redeems']\n", + "\n", + "current_results = current.Query.carbonPoolCreditBalanceDailySnapshots(\n", + " first=number_records,\n", + " orderBy=current.CarbonPoolCreditBalanceDailySnapshot.id,\n", + " orderDirection='asc'\n", + ")\n", + "\n", + "df_current = sg.query_df(\n", + " get_all_query_fields(current_results, derived_fields)\n", + ")\n", + "\n", + "new_results = staging.Query.carbonPoolCreditBalanceDailySnapshots(\n", + " first=number_records,\n", + " orderBy=staging.CarbonPoolCreditBalanceDailySnapshot.id,\n", + " orderDirection='asc'\n", + ")\n", + "\n", + "df_new = sg.query_df(\n", + " get_all_query_fields(new_results, derived_fields)\n", + ")\n", + "\n", + "df_current.compare(df_new)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 65, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + "
\n", + "
" + ], + "text/plain": [ + "Empty DataFrame\n", + "Columns: []\n", + "Index: []" + ] + }, + "execution_count": 65, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Pool Deposit entity\n", + "\n", + "derived_fields = []\n", + "\n", + "current_results = current.Query.poolDeposits(\n", + " first=number_records,\n", + " orderBy=current.PoolDeposit.id,\n", + " orderDirection='asc'\n", + ")\n", + "\n", + "df_current = sg.query_df(\n", + " get_all_query_fields(current_results, derived_fields)\n", + ")\n", + "\n", + "new_results = staging.Query.poolDeposits(\n", + " first=number_records,\n", + " orderBy=staging.PoolDeposit.id,\n", + " orderDirection='asc'\n", + ")\n", + "\n", + "df_new = sg.query_df(\n", + " get_all_query_fields(new_results, derived_fields)\n", + ")\n", + "\n", + "df_current.compare(df_new)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 66, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + "
\n", + "
" + ], + "text/plain": [ + "Empty DataFrame\n", + "Columns: []\n", + "Index: []" + ] + }, + "execution_count": 66, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Pool Redeem entity\n", + "\n", + "derived_fields = []\n", + "\n", + "current_results = current.Query.poolRedeems(\n", + " first=number_records,\n", + " orderBy=current.PoolRedeem.id,\n", + " orderDirection='asc'\n", + ")\n", + "\n", + "df_current = sg.query_df(\n", + " get_all_query_fields(current_results, derived_fields)\n", + ")\n", + "\n", + "new_results = staging.Query.poolRedeems(\n", + " first=number_records,\n", + " orderBy=staging.PoolRedeem.id,\n", + " orderDirection='asc'\n", + ")\n", + "\n", + "df_new = sg.query_df(\n", + " get_all_query_fields(new_results, derived_fields)\n", + ")\n", + "\n", + "df_current.compare(df_new)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 69, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + "
\n", + "
" + ], + "text/plain": [ + "Empty DataFrame\n", + "Columns: []\n", + "Index: []" + ] + }, + "execution_count": 69, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Account entity\n", + "\n", + "derived_fields = ['bridges','retiresBeneficiary','retiresInitiator','poolDeposits','poolRedeems','holdings','holdingSnapshots']\n", + "\n", + "current_results = current.Query.accounts(\n", + " first=number_records,\n", + " orderBy=current.Account.id,\n", + " orderDirection='asc'\n", + ")\n", + "\n", + "df_current = sg.query_df(\n", + " get_all_query_fields(current_results, derived_fields)\n", + ")\n", + "\n", + "new_results = staging.Query.accounts(\n", + " first=number_records,\n", + " orderBy=staging.Account.id,\n", + " orderDirection='asc'\n", + ")\n", + "\n", + "df_new = sg.query_df(\n", + " get_all_query_fields(new_results, derived_fields)\n", + ")\n", + "\n", + "df_current.compare(df_new)\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Holding entity\n", + "\n", + "derived_fields = []\n", + "\n", + "current_results = current.Query.holdings(\n", + " first=number_records,\n", + " orderBy=current.Holding.id,\n", + " orderDirection='asc'\n", + ")\n", + "\n", + "df_current = sg.query_df(\n", + " get_all_query_fields(current_results, derived_fields)\n", + ")\n", + "\n", + "new_results = staging.Query.holdings(\n", + " first=number_records,\n", + " orderBy=staging.Holding.id,\n", + " orderDirection='asc'\n", + ")\n", + "\n", + "df_new = sg.query_df(\n", + " get_all_query_fields(new_results, derived_fields)\n", + ")\n", + "\n", + "df_current.compare(df_new)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 74, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + "
\n", + "
" + ], + "text/plain": [ + "Empty DataFrame\n", + "Columns: []\n", + "Index: []" + ] + }, + "execution_count": 74, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Holding Daily Snapshots entity\n", + "\n", + "derived_fields = []\n", + "\n", + "current_results = current.Query.holdingDailySnapshots(\n", + " first=number_records,\n", + " orderBy=current.HoldingDailySnapshot.id,\n", + " orderDirection='asc'\n", + ")\n", + "\n", + "df_current = sg.query_df(\n", + " get_all_query_fields(current_results, derived_fields)\n", + ")\n", + "\n", + "new_results = staging.Query.holdingDailySnapshots(\n", + " first=number_records,\n", + " orderBy=staging.HoldingDailySnapshot.id,\n", + " orderDirection='asc'\n", + ")\n", + "\n", + "df_new = sg.query_df(\n", + " get_all_query_fields(new_results, derived_fields)\n", + ")\n", + "\n", + "df_current.compare(df_new)\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3.10.4 64-bit ('klima-analytics')", + "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.10.4" + }, + "orig_nbformat": 4, + "vscode": { + "interpreter": { + "hash": "afceb56415c785c82a47f436db0adc75581a14869f628f3e6d39d0c753714835" + } + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}