Skip to content

Commit

Permalink
IO: Add domain_models.io
Browse files Browse the repository at this point in the history
  • Loading branch information
nico-corthorn committed Nov 11, 2024
1 parent 774cfc2 commit cf6e967
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ jobs:
- name: Install dependencies
run: |
make install
- name: Lint
run: |
make lint
- name: Test with pytest
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
Expand All @@ -39,9 +42,6 @@ jobs:
AWS_SAM_STACK_NAME: ${{ secrets.AWS_SAM_STACK_NAME }}
run: |
make sambuild
- name: Lint
run: |
make lint
- name: SAM deploy
if: success()
env:
Expand Down
22 changes: 22 additions & 0 deletions esgtools/domain_models/io.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from dataclasses import dataclass


@dataclass
class SQLParams:
"""Credentials to an RDS database."""

dbname: str
username: str
password: str
host: str
port: int


def convert_dict_to_sql_params(db_credentials: dict) -> SQLParams:
filtered_db_credentials = {
key: db_credentials[key]
for key in SQLParams.__annotations__
if key in db_credentials
}
sql_params = SQLParams(**filtered_db_credentials)
return sql_params

0 comments on commit cf6e967

Please sign in to comment.