Skip to content

Commit

Permalink
fix style to get unit tests to pass
Browse files Browse the repository at this point in the history
  • Loading branch information
arzavj committed Apr 6, 2021
1 parent 2370734 commit f56f521
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions plugins/postgres/dbt/adapters/postgres/impl.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from datetime import datetime
from dataclasses import dataclass
from typing import Optional, Set, Dict, List, Any
from typing import Optional, Set, List, Any
from dbt.adapters.base.meta import available
from dbt.adapters.base.impl import AdapterConfig
from dbt.adapters.sql import SQLAdapter
Expand All @@ -23,12 +23,13 @@ class PostgresIndexConfig(dbtClassMixin):
type: Optional[str] = None

def render(self, relation):
# We append the current timestamp to the index name because otherwise the index
# will only be created on every other run. See
# https://github.com/fishtown-analytics/dbt/issues/1945#issuecomment-576714925 for
# an explanation.
# We append the current timestamp to the index name because otherwise
# the index will only be created on every other run. See
# https://github.com/fishtown-analytics/dbt/issues/1945#issuecomment-576714925
# for an explanation.
now = datetime.utcnow().isoformat()
inputs = self.columns + [relation.render(), str(self.unique), str(self.type), now]
inputs = (self.columns +
[relation.render(), str(self.unique), str(self.type), now])
string = '_'.join(inputs)
return dbt.utils.md5(string)

Expand All @@ -51,6 +52,7 @@ def parse(cls, raw_index) -> Optional['PostgresIndexConfig']:
f' Expected a dictionary with at minimum a "columns" key'
)


@dataclass
class PostgresConfig(AdapterConfig):
unlogged: Optional[bool] = None
Expand Down

0 comments on commit f56f521

Please sign in to comment.