Skip to content
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

prototype for multiple engines #481

Merged
merged 4 commits into from
Apr 8, 2022
Merged

prototype for multiple engines #481

merged 4 commits into from
Apr 8, 2022

Conversation

dantownsend
Copy link
Member

@dantownsend dantownsend commented Apr 8, 2022

Fixes #142

You can now specify extra nodes for a database. For example, if you have a read replica.

DB = PostgresEngine(
    config={'database': 'main_db'},
    extra_nodes={
        'read_replica_1': PostgresEngine(
            config={
                'database': 'main_db',
                'host': 'read_replica_1.my_db.com'
            }
        )
    }
)

And can then run queries on these other nodes using:

await MyTable.select().run(node="read_replica_1")

@dantownsend dantownsend added the enhancement New feature or request label Apr 8, 2022
@codecov-commenter
Copy link

codecov-commenter commented Apr 8, 2022

Codecov Report

Merging #481 (f2b908f) into master (89fb031) will decrease coverage by 0.03%.
The diff coverage is 66.66%.

@@            Coverage Diff             @@
##           master     #481      +/-   ##
==========================================
- Coverage   90.82%   90.79%   -0.04%     
==========================================
  Files         104      104              
  Lines        6923     6930       +7     
==========================================
+ Hits         6288     6292       +4     
- Misses        635      638       +3     
Impacted Files Coverage Δ
piccolo/query/base.py 84.46% <50.00%> (-1.18%) ⬇️
piccolo/engine/postgres.py 87.12% <100.00%> (+0.19%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 89fb031...f2b908f. Read the comment docs.

@dantownsend dantownsend merged commit 2ba0891 into master Apr 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Question] Is there a capability to connect to multiple databases
2 participants