-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reorganize record/replay code to match dbt-adapters.
- Loading branch information
1 parent
64e2ea6
commit bdbfc3b
Showing
5 changed files
with
43 additions
and
35 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from dbt.adapters.postgres.record.cursor.cursor import PostgresRecordReplayCursor | ||
from dbt.adapters.postgres.record.handle import PostgresRecordReplayHandle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from dbt_common.record import record_function | ||
|
||
from dbt.adapters.record import RecordReplayCursor | ||
|
||
from dbt.adapters.postgres.record.cursor.status import CursorGetStatusMessageRecord | ||
|
||
|
||
class PostgresRecordReplayCursor(RecordReplayCursor): | ||
@property | ||
@record_function(CursorGetStatusMessageRecord, method=True, id_field_name="connection_name") | ||
def statusmessage(self): | ||
return self.native_cursor.statusmessage | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import dataclasses | ||
from typing import Optional | ||
|
||
from dbt_common.record import Record, Recorder | ||
|
||
@dataclasses.dataclass | ||
class CursorGetStatusMessageParams: | ||
connection_name: str | ||
|
||
|
||
@dataclasses.dataclass | ||
class CursorGetStatusMessageResult: | ||
msg: Optional[str] | ||
|
||
|
||
@Recorder.register_record_type | ||
class CursorGetStatusMessageRecord(Record): | ||
params_cls = CursorGetStatusMessageParams | ||
result_cls = CursorGetStatusMessageResult | ||
group = "Database" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from dbt.adapters.record import RecordReplayHandle | ||
|
||
from dbt.adapters.postgres.record.cursor.cursor import PostgresRecordReplayCursor | ||
|
||
class PostgresRecordReplayHandle(RecordReplayHandle): | ||
def cursor(self): | ||
cursor = None if self.native_handle is None else self.native_handle.cursor() | ||
return PostgresRecordReplayCursor(cursor, self.connection) |