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

Martin serving multiple database connections #1684

Closed
darrenpierre90 opened this issue Feb 10, 2025 · 6 comments
Closed

Martin serving multiple database connections #1684

darrenpierre90 opened this issue Feb 10, 2025 · 6 comments
Labels
config Relates to Martin configuration question

Comments

@darrenpierre90
Copy link

darrenpierre90 commented Feb 10, 2025

Hi, I'm attempting to use Martin to serve from multiple Postgres databases. To do that I'm trying to setup Martin config where we can set up various 2 but potentially more Postgres databases

what have I tried so far?

I've tried adding two connection strings and it seems the second connection string overwrites the first one.

I've put a connection string in an array, but that also doesn't work.

in the Martin docs , it says

Database configuration. This can also be a list of PG configs.

But confused about how to set it up .

Any Help would be appreciative.

@CommanderStorm
Copy link
Collaborator

This might be badly documented or we might have a bug.

We mean this like here:

postgres:
- connection_string: 'postgres://postgres@localhost:5432/db'
- connection_string: 'postgresql://postgres@localhost:5433/db'

=> a list of postgres-configurations, not a list of connection_strings

Could you recheck if you have 2 configs?

If the issue is what I think it is, how would you have understood the docs how We meant it:
Would the following be better

# Database configuration.
# 
# This can also be a list of postgres configurations (i.e. a list of the dicutionary shown below)

@CommanderStorm CommanderStorm added question config Relates to Martin configuration labels Feb 10, 2025
@darrenpierre90
Copy link
Author

Image

I've also tried that variant and I got the following error :
Image

@darrenpierre90
Copy link
Author

I think if there was just an example shown , it would make the documentation better

@nyurik
Copy link
Member

nyurik commented Feb 11, 2025

this is not valid yaml.

listen_addresses: '0.0.0.0:3000'
postgres:
  - connection_string: 'postgresql://server1'
    default_srid: 4326
    auto_bounds: skip
  - connection_string: 'postgresql://server2'
    default_srid: 4326
    auto_bounds: skip

@nyurik
Copy link
Member

nyurik commented Feb 11, 2025

Any documentation improvement PRs are welcome ;)

@darrenpierre90
Copy link
Author

Great thanks it works now thank you @nyurik @CommanderStorm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
config Relates to Martin configuration question
Projects
None yet
Development

No branches or pull requests

3 participants