-
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.
update project.toml due to conflicts
- Loading branch information
Showing
11 changed files
with
166 additions
and
34 deletions.
There are no files selected for viewing
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,6 @@ | ||
kind: Under the Hood | ||
body: Add support for experimental record/replay testing. | ||
time: 2024-07-16T17:24:42.271859-04:00 | ||
custom: | ||
Author: peterallenwebb | ||
Issue: "123" |
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
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
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
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
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
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,15 @@ | ||
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): | ||
"""A custom extension of RecordReplayCursor that adds the statusmessage | ||
property which is specific to psycopg.""" | ||
|
||
@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,21 @@ | ||
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,12 @@ | ||
from dbt.adapters.record import RecordReplayHandle | ||
|
||
from dbt.adapters.postgres.record.cursor.cursor import PostgresRecordReplayCursor | ||
|
||
|
||
class PostgresRecordReplayHandle(RecordReplayHandle): | ||
"""A custom extension of RecordReplayHandle that returns | ||
a psycopg-specific PostgresRecordReplayCursor object.""" | ||
|
||
def cursor(self): | ||
cursor = None if self.native_handle is None else self.native_handle.cursor() | ||
return PostgresRecordReplayCursor(cursor, self.connection) |
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