-
Notifications
You must be signed in to change notification settings - Fork 0
/
GAME_TEXT_delete_gridly_data.py
31 lines (25 loc) · 1.04 KB
/
GAME_TEXT_delete_gridly_data.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import os
import logging
from src.gridly_client import GridlyClient
def main():
"""
If, for whatever reason, there's a need to drop all records for a specific view in Gridly.
Feels unnecessary, the UI is super nice, but it's here just in case.
"""
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
api_key = os.getenv("GRIDLY_API_KEY")
view_id = os.getenv("GAME_VIEW_ID")
if not api_key:
raise ValueError("API key not provided. Please set GRIDLY_API_KEY in your environment variables.")
if not view_id:
raise ValueError("View ID not provided. Please set GRIDLY_VIEW_ID in your environment variables.")
gridly_client = GridlyClient(api_key=api_key)
try:
logger.info(f"Attempting to delete all records from view: {view_id}")
gridly_client.delete_all_records(view_id)
logger.info("All records deleted successfully.")
except RuntimeError as e:
logger.error(f"An error occurred: {str(e)}")
if __name__ == "__main__":
main()