From 312931b4b470b5632d11e5879c12bcb168458751 Mon Sep 17 00:00:00 2001 From: Andrey Date: Tue, 17 Dec 2024 13:33:51 +0200 Subject: [PATCH] Update model import. --- crawlers/mooncrawl/mooncrawl/actions.py | 1 + crawlers/mooncrawl/mooncrawl/api.py | 13 ++++++++++--- crawlers/mooncrawl/mooncrawl/settings.py | 3 +-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/crawlers/mooncrawl/mooncrawl/actions.py b/crawlers/mooncrawl/mooncrawl/actions.py index ba6cf868..3ceb70f3 100644 --- a/crawlers/mooncrawl/mooncrawl/actions.py +++ b/crawlers/mooncrawl/mooncrawl/actions.py @@ -145,6 +145,7 @@ def recive_S3_data_from_query( json=json, timeout=5, ) + print(response.json()) data_url = MoonstreamQueryResultUrl(url=response.json()["url"]) else: data_url = client.exec_query( diff --git a/crawlers/mooncrawl/mooncrawl/api.py b/crawlers/mooncrawl/mooncrawl/api.py index 615d2805..9feb83b2 100644 --- a/crawlers/mooncrawl/mooncrawl/api.py +++ b/crawlers/mooncrawl/mooncrawl/api.py @@ -13,7 +13,7 @@ from bugout.data import BugoutJournalEntity, BugoutResource from fastapi import BackgroundTasks, FastAPI from fastapi.middleware.cors import CORSMiddleware -from moonstreamdb.blockchain import ( +from moonstreamtypes.blockchain import ( AvailableBlockchainType, get_block_model, get_label_model, @@ -231,6 +231,7 @@ async def queries_data_update_handler( raise MoonstreamHTTPException(status_code=500) requested_query = request_data.query + labels_version = 2 blockchain_table = "polygon_labels" if request_data.blockchain: @@ -240,6 +241,12 @@ async def queries_data_update_handler( blockchain = AvailableBlockchainType(request_data.blockchain) + if ( + request_data.customer_id is not None + and request_data.instance_id is not None + ): + labels_version = 3 + requested_query = ( requested_query.replace( "__transactions_table__", @@ -251,11 +258,11 @@ async def queries_data_update_handler( ) .replace( "__labels_table__", - get_label_model(blockchain).__tablename__, + get_label_model(blockchain, labels_version).__tablename__, ) ) - blockchain_table = get_label_model(blockchain).__tablename__ + blockchain_table = get_label_model(blockchain, labels_version).__tablename__ # Check if it can transform to TextClause try: diff --git a/crawlers/mooncrawl/mooncrawl/settings.py b/crawlers/mooncrawl/mooncrawl/settings.py index f477c4af..18e3810d 100644 --- a/crawlers/mooncrawl/mooncrawl/settings.py +++ b/crawlers/mooncrawl/mooncrawl/settings.py @@ -41,7 +41,6 @@ ) - # Origin RAW_ORIGINS = os.environ.get("MOONSTREAM_CORS_ALLOWED_ORIGINS") if RAW_ORIGINS is None: @@ -392,6 +391,7 @@ AvailableBlockchainType.BLAST: "0xcA11bde05977b3631167028862bE2a173976CA11", AvailableBlockchainType.MANTLE: "0xcA11bde05977b3631167028862bE2a173976CA11", AvailableBlockchainType.MANTLE_SEPOLIA: "0xcA11bde05977b3631167028862bE2a173976CA11", + AvailableBlockchainType.GAME7_TESTNET: "0xcA11bde05977b3631167028862bE2a173976CA11", } @@ -501,4 +501,3 @@ MOONSTREAM_DB_V3_SCHEMA_NAME = os.environ.get( "MOONSTREAM_DB_V3_SCHEMA_NAME", "blockchain" ) -