Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ssl prefer to remaining redshift areas, increase timeout (maybe) #4981

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ The types of changes are:
### Added
- Adds last_monitored and enabled attributes to MonitorConfig [#4991](https://github.com/ethyca/fides/pull/4991)

### Fixed
- Fixed intermittent connection issues with Redshift by increasing timeout and preferring SSL in test connections [#4981](https://github.com/ethyca/fides/pull/4981)

## [2.39.0](https://github.com/ethyca/fides/compare/2.38.1...2.39.0)

### Added
Expand Down
10 changes: 9 additions & 1 deletion src/fides/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
)
if "redshift" in connection_string:
connect_args["sslmode"] = "prefer"
connect_args["connect_timeout"] = 60

Check warning on line 44 in src/fides/core/utils.py

View check run for this annotation

Codecov / codecov/patch

src/fides/core/utils.py#L44

Added line #L44 was not covered by tests
try:
engine = sqlalchemy.create_engine(connection_string, connect_args=connect_args)
except Exception as err:
Expand All @@ -58,8 +59,15 @@
"""
Use SQLAlchemy to create a DB engine.
"""
# Pymssql doesn't support this arg
connect_args: Dict[str, Any] = (

Check warning on line 63 in src/fides/core/utils.py

View check run for this annotation

Codecov / codecov/patch

src/fides/core/utils.py#L63

Added line #L63 was not covered by tests
{"connect_timeout": 10} if "pymssql" not in connection_string else {}
)
if "redshift" in connection_string:
connect_args["sslmode"] = "prefer"
connect_args["connect_timeout"] = 60

Check warning on line 68 in src/fides/core/utils.py

View check run for this annotation

Codecov / codecov/patch

src/fides/core/utils.py#L67-L68

Added lines #L67 - L68 were not covered by tests
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Redshift datasets from Axios were taking forever to load, this number let it run long enough to respond with all of the dataset information

try:
engine = sqlalchemy.create_engine(connection_string)
engine = sqlalchemy.create_engine(connection_string, connect_args=connect_args)

Check warning on line 70 in src/fides/core/utils.py

View check run for this annotation

Codecov / codecov/patch

src/fides/core/utils.py#L70

Added line #L70 was not covered by tests
with engine.begin() as connection:
connection.execute("SELECT 1")
except SQLAlchemyError as error:
Expand Down