-
Notifications
You must be signed in to change notification settings - Fork 27
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
feat: Custom replication slot name #543
Open
RobyBen
wants to merge
22
commits into
MeltanoLabs:main
Choose a base branch
from
RobyBen:feature/slot_name
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 14 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
f0abd1e
add support for configurable replication_slot_name in logical replica…
RobyBen b9de248
fixes
RobyBen d2c6ed5
another fixes
RobyBen 970ec8d
idk why dont work
RobyBen c7e7236
finaly&
RobyBen f811255
ruff format
RobyBen 802bda8
little changes client.py and tap.py
RobyBen e81b989
ruff format again
RobyBen 098b239
changed th.Property
RobyBen a8e2720
I forgot to delete the asserts
RobyBen d2b38aa
Move `pattern` parameter to `StringType` instance
edgarrmondragon eb7bea3
Update tap_postgres/tap.py
edgarrmondragon 1aceb57
Merge branch 'main' into feature/slot_name
edgarrmondragon 4f9deb3
Use keyword argument in tests
edgarrmondragon 80071d2
Add `user`
edgarrmondragon cc8960f
Add `password`
edgarrmondragon c61234f
Update tests/test_slot_name.py
edgarrmondragon 14f1854
changed default_config in the test, maybe it will help
RobyBen e45cd2a
Changed default_config in the test, maybe it will help. Please check …
RobyBen 40a06fd
Merge branch 'main' into feature/slot_name
RobyBen 6f21aa3
Merge branch 'feature/slot_name' of https://github.com/RobyBen/tap-po…
RobyBen 73b7e8b
Ok, the default_config in the test should have changed , maybe that w…
RobyBen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,51 @@ | ||
import unittest | ||
|
||
from tap_postgres.tap import TapPostgres | ||
|
||
|
||
class TestReplicationSlot(unittest.TestCase): | ||
def setUp(self): | ||
self.default_config = { | ||
"host": "localhost", | ||
"port": 5432, | ||
"dbname": "test_db", | ||
edgarrmondragon marked this conversation as resolved.
Show resolved
Hide resolved
edgarrmondragon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
def test_default_slot_name(self): | ||
# Test backward compatibility when slot name is not provided. | ||
config = self.default_config | ||
tap = TapPostgres(config=config) | ||
self.assertEqual( | ||
tap.config.get("replication_slot_name", "tappostgres"), "tappostgres" | ||
) | ||
|
||
def test_custom_slot_name(self): | ||
# Test if the custom slot name is used. | ||
config = {**self.default_config, "replication_slot_name": "custom_slot"} | ||
tap = TapPostgres(config=config) | ||
self.assertEqual(tap.config["replication_slot_name"], "custom_slot") | ||
|
||
def test_multiple_slots(self): | ||
# Simulate using multiple configurations with different slot names. | ||
config_1 = {**self.default_config, "replication_slot_name": "slot_1"} | ||
config_2 = {**self.default_config, "replication_slot_name": "slot_2"} | ||
|
||
tap_1 = TapPostgres(config=config_1) | ||
tap_2 = TapPostgres(config=config_2) | ||
|
||
self.assertNotEqual( | ||
tap_1.config["replication_slot_name"], | ||
tap_2.config["replication_slot_name"], | ||
) | ||
self.assertEqual(tap_1.config["replication_slot_name"], "slot_1") | ||
self.assertEqual(tap_2.config["replication_slot_name"], "slot_2") | ||
|
||
def test_invalid_slot_name(self): | ||
# Test validation for invalid slot names (if any validation rules exist). | ||
invalid_config = { | ||
**self.default_config, | ||
"replication_slot_name": "invalid slot name!", | ||
} | ||
|
||
with self.assertRaises(ValueError): | ||
TapPostgres(config=invalid_config) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we remove these examples or perhaps move them to the readme?