Skip to content

Commit

Permalink
Add classifiers table
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon authored and sethmlarson committed Jul 3, 2024
1 parent daece58 commit 9dcce18
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,18 @@ def update_data_for_package(package: str) -> None:
(package, check_name, check_score),
)

classifiers = resp["info"].get("classifiers") or []
for classifier in classifiers:
db.execute(
"""
INSERT OR IGNORE INTO classifiers (
package_name,
name
) VALUES (?, ?);
""",
(package, classifier),
)

return package


Expand Down Expand Up @@ -551,6 +563,16 @@ def get_google_assured_oss_packages(http: urllib3.PoolManager) -> set[str]:
);
"""
)
_DB.execute(
"""
CREATE TABLE IF NOT EXISTS classifiers (
package_name TEXT,
name TEXT,
PRIMARY KEY (package_name, name),
FOREIGN KEY (package_name) REFERENCES packages(name)
);
"""
)
_DB.execute(
"""
CREATE INDEX IF NOT EXISTS idx_packages_name ON packages (name);
Expand Down

0 comments on commit 9dcce18

Please sign in to comment.