zombie-squirrel 0.1.1__tar.gz → 0.1.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {zombie_squirrel-0.1.1/src/zombie_squirrel.egg-info → zombie_squirrel-0.1.3}/PKG-INFO +1 -1
- zombie_squirrel-0.1.3/src/zombie_squirrel/__init__.py +4 -0
- {zombie_squirrel-0.1.1 → zombie_squirrel-0.1.3}/src/zombie_squirrel/acorns.py +1 -4
- {zombie_squirrel-0.1.1 → zombie_squirrel-0.1.3}/src/zombie_squirrel/squirrels.py +3 -6
- zombie_squirrel-0.1.3/src/zombie_squirrel/utils.py +20 -0
- {zombie_squirrel-0.1.1 → zombie_squirrel-0.1.3/src/zombie_squirrel.egg-info}/PKG-INFO +1 -1
- {zombie_squirrel-0.1.1 → zombie_squirrel-0.1.3}/src/zombie_squirrel.egg-info/SOURCES.txt +1 -0
- zombie_squirrel-0.1.1/src/zombie_squirrel/__init__.py +0 -4
- {zombie_squirrel-0.1.1 → zombie_squirrel-0.1.3}/LICENSE +0 -0
- {zombie_squirrel-0.1.1 → zombie_squirrel-0.1.3}/README.md +0 -0
- {zombie_squirrel-0.1.1 → zombie_squirrel-0.1.3}/pyproject.toml +0 -0
- {zombie_squirrel-0.1.1 → zombie_squirrel-0.1.3}/setup.cfg +0 -0
- {zombie_squirrel-0.1.1 → zombie_squirrel-0.1.3}/setup.py +0 -0
- {zombie_squirrel-0.1.1 → zombie_squirrel-0.1.3}/src/zombie_squirrel/sync.py +0 -0
- {zombie_squirrel-0.1.1 → zombie_squirrel-0.1.3}/src/zombie_squirrel.egg-info/dependency_links.txt +0 -0
- {zombie_squirrel-0.1.1 → zombie_squirrel-0.1.3}/src/zombie_squirrel.egg-info/requires.txt +0 -0
- {zombie_squirrel-0.1.1 → zombie_squirrel-0.1.3}/src/zombie_squirrel.egg-info/top_level.txt +0 -0
|
@@ -4,10 +4,7 @@ import pandas as pd
|
|
|
4
4
|
import os
|
|
5
5
|
|
|
6
6
|
from aind_data_access_api.rds_tables import Client, RDSCredentials
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def prefix_table_name(table_name: str) -> str:
|
|
10
|
-
return "zs_" + table_name
|
|
7
|
+
from zombie_squirrel.utils import prefix_table_name
|
|
11
8
|
|
|
12
9
|
|
|
13
10
|
class Acorn(ABC):
|
|
@@ -5,6 +5,7 @@ from zombie_squirrel.acorns import RedshiftAcorn, MemoryAcorn
|
|
|
5
5
|
from aind_data_access_api.document_db import MetadataDbClient
|
|
6
6
|
import os
|
|
7
7
|
import logging
|
|
8
|
+
from zombie_squirrel.utils import prefix_table_name, rds_get_handle_empty
|
|
8
9
|
|
|
9
10
|
# --- Backend setup ---------------------------------------------------
|
|
10
11
|
|
|
@@ -42,11 +43,7 @@ NAMES = {
|
|
|
42
43
|
|
|
43
44
|
@register_squirrel(NAMES["upn"])
|
|
44
45
|
def unique_project_names(force_update: bool = False) -> list[str]:
|
|
45
|
-
|
|
46
|
-
df = ACORN.scurry(NAMES["upn"])
|
|
47
|
-
except Exception as e:
|
|
48
|
-
logging.warning(f"Error fetching from cache: {e}")
|
|
49
|
-
df = pd.DataFrame()
|
|
46
|
+
df = rds_get_handle_empty(ACORN, NAMES["upn"])
|
|
50
47
|
|
|
51
48
|
if df.empty or force_update:
|
|
52
49
|
# If cache is missing, fetch data
|
|
@@ -69,7 +66,7 @@ def unique_project_names(force_update: bool = False) -> list[str]:
|
|
|
69
66
|
|
|
70
67
|
@register_squirrel(NAMES["usi"])
|
|
71
68
|
def unique_subject_ids(force_update: bool = False) -> list[str]:
|
|
72
|
-
df = ACORN
|
|
69
|
+
df = rds_get_handle_empty(ACORN, NAMES["usi"])
|
|
73
70
|
|
|
74
71
|
if df.empty or force_update:
|
|
75
72
|
# If cache is missing, fetch data
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"""Utility functions"""
|
|
2
|
+
import pandas as pd
|
|
3
|
+
import logging
|
|
4
|
+
|
|
5
|
+
from zombie_squirrel.acorns import Acorn
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def prefix_table_name(table_name: str) -> str:
|
|
9
|
+
return "zs_" + table_name
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def rds_get_handle_empty(acorn: Acorn, table_name: str) -> pd.DataFrame:
|
|
13
|
+
"""Utility function for testing purposes."""
|
|
14
|
+
try:
|
|
15
|
+
df = acorn.scurry(table_name)
|
|
16
|
+
except Exception as e:
|
|
17
|
+
logging.warning(f"Error fetching from cache: {e}")
|
|
18
|
+
df = pd.DataFrame()
|
|
19
|
+
|
|
20
|
+
return df
|
|
@@ -6,6 +6,7 @@ src/zombie_squirrel/__init__.py
|
|
|
6
6
|
src/zombie_squirrel/acorns.py
|
|
7
7
|
src/zombie_squirrel/squirrels.py
|
|
8
8
|
src/zombie_squirrel/sync.py
|
|
9
|
+
src/zombie_squirrel/utils.py
|
|
9
10
|
src/zombie_squirrel.egg-info/PKG-INFO
|
|
10
11
|
src/zombie_squirrel.egg-info/SOURCES.txt
|
|
11
12
|
src/zombie_squirrel.egg-info/dependency_links.txt
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{zombie_squirrel-0.1.1 → zombie_squirrel-0.1.3}/src/zombie_squirrel.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|