nabilcheikh1 commited on
Commit
b9122de
·
1 Parent(s): b1341dd

reset embedding effective

Browse files
src/api/services/postgresql_service.py ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import logging
2
+ from typing import List
3
+ from src.api.database import Database
4
+
5
+ logger = logging.getLogger(__name__)
6
+
7
+ class PostgresqlService:
8
+ def __init__(self, db: Database):
9
+ self.db = db
10
+
11
+
12
+ async def get_db_rows_from_dataset_name(self, dataset) -> List:
13
+ query_mapping = {
14
+ "re-mind/product_type_embedding": {
15
+ "column": "type",
16
+ "table": "product_producttype",
17
+ },
18
+ "re-mind/marketplace_name_embedding": {
19
+ "column": "name",
20
+ "table": "invoice_marketplace",
21
+ },
22
+ "re-mind/manufacturer_name_embedding": {
23
+ "column": "name",
24
+ "table": "product_manufacturer",
25
+ },
26
+ "re-mind/seller_name_embedding": {
27
+ "column": "name",
28
+ "table": "product_seller",
29
+ }
30
+ }
31
+
32
+ db_table = query_mapping[dataset]["table"]
33
+ column = query_mapping[dataset]["column"]
34
+ query = f"SELECT {column} FROM {db_table}"
35
+
36
+ results = await self.db.fetch(query)
37
+
38
+ return results