Skip to content

Commit

Permalink
Update model import.
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey committed Dec 17, 2024
1 parent 28e6163 commit 312931b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions crawlers/mooncrawl/mooncrawl/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
13 changes: 10 additions & 3 deletions crawlers/mooncrawl/mooncrawl/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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:
Expand All @@ -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__",
Expand All @@ -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:
Expand Down
3 changes: 1 addition & 2 deletions crawlers/mooncrawl/mooncrawl/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
)



# Origin
RAW_ORIGINS = os.environ.get("MOONSTREAM_CORS_ALLOWED_ORIGINS")
if RAW_ORIGINS is None:
Expand Down Expand Up @@ -392,6 +391,7 @@
AvailableBlockchainType.BLAST: "0xcA11bde05977b3631167028862bE2a173976CA11",
AvailableBlockchainType.MANTLE: "0xcA11bde05977b3631167028862bE2a173976CA11",
AvailableBlockchainType.MANTLE_SEPOLIA: "0xcA11bde05977b3631167028862bE2a173976CA11",
AvailableBlockchainType.GAME7_TESTNET: "0xcA11bde05977b3631167028862bE2a173976CA11",
}


Expand Down Expand Up @@ -501,4 +501,3 @@
MOONSTREAM_DB_V3_SCHEMA_NAME = os.environ.get(
"MOONSTREAM_DB_V3_SCHEMA_NAME", "blockchain"
)

0 comments on commit 312931b

Please sign in to comment.