Skip to content

Commit

Permalink
Merge pull request #8 from vinted/test/no_protos
Browse files Browse the repository at this point in the history
Enable fetching the SQL Registry password from an environment variable
  • Loading branch information
danielsalvador authored Oct 18, 2023
2 parents ef54edc + 864783b commit cf95e08
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -223,4 +223,4 @@ ui/.vercel
**/yarn-error.log*

# Go subprocess binaries (built during feast pip package building)
sdk/python/feast/binaries/
sdk/python/feast/binaries/
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def pull_latest_from_table_or_query(
FROM (
SELECT {a_field_string},
ROW_NUMBER() OVER({partition_by_join_key_string} ORDER BY {timestamp_desc_string}) AS _feast_row
FROM ({from_expression}) a
FROM {from_expression} a
WHERE a."{timestamp_field}" BETWEEN '{start_date}'::timestamptz AND '{end_date}'::timestamptz
) b
WHERE _feast_row = 1
Expand Down
12 changes: 11 additions & 1 deletion sdk/python/feast/infra/registry/sql.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
import os
import uuid
from datetime import datetime, timedelta
from enum import Enum
Expand Down Expand Up @@ -199,7 +200,16 @@ def __init__(
repo_path: Optional[Path],
):
assert registry_config is not None, "SqlRegistry needs a valid registry_config"
self.engine: Engine = create_engine(registry_config.path, echo=False)

sqlalchemy_url = registry_config.path
if "__placeholder_password__" in sqlalchemy_url:
secret_password = os.getenv("FEAST_SQL_REGISTRY_PASSWORD")
if secret_password:
sqlalchemy_url = sqlalchemy_url.replace("__placeholder_password__", secret_password)
else:
raise ValueError("'FEAST_SQL_REGISTRY_PASSWORD' is not set!")

self.engine: Engine = create_engine(sqlalchemy_url, echo=False)
metadata.create_all(self.engine)
self.cached_registry_proto = self.proto()
proto_registry_utils.init_project_metadata(self.cached_registry_proto, project)
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,14 @@
"build",
"virtualenv==20.23.0",
"cryptography>=35.0,<42",
"flake8>=6.0.0,<6.1.0",
"black>=22.6.0,<23",
"flake8>=6.0.0,<6.2.0",
"black>=22.6.0,<24",
"isort>=5,<6",
"grpcio-testing>=1.56.2,<2",
"minio==7.1.0",
"mock==2.0.0",
"moto",
"mypy>=0.981,<0.990",
"mypy>=0.981,<2",
"avro==1.10.0",
"gcsfs>=0.4.0,<=2022.01.0",
"urllib3>=1.25.4,<2",
Expand Down

0 comments on commit cf95e08

Please sign in to comment.