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

Enable Full Read-Only Mode for Connection to Read-Only DBs (Such As Production Read-Replicas) in Mathesar #3578

Open
arvindamirtaa opened this issue May 10, 2024 · 2 comments
Labels
needs: implementation specs We need clarity on HOW we'll implement it from a technical perspective needs: requirements The problem is clear and worth solving, but we're not yet sure of the best solution type: enhancement New feature or request user reported Reported by a Mathesar user work: backend Related to Python, Django, and simple SQL work: db-layer Related to SQL or PL/pgSQL
Milestone

Comments

@arvindamirtaa
Copy link

Problem

I am interested in connecting Mathesar to a production read replica for our data analysis needs, but I'm encountering significant barriers due to current application requirements. Primarily, Mathesar's necessity to alter the database structure just to establish a read connection is excessively intrusive. This requirement conflicts with our policies aimed at minimizing changes to the production database to ensure maximum stability and security.

Additionally, the permission level of our reporting user does not allow for the installation of new schemas, a prerequisite for using Mathesar. This limitation prevents me from trialing the tool independently, as I would need team approval for schema creation before I can even begin testing. Without the ability to trial and test these schemas personally, I'm unable to demonstrate their potential value or functionality, which is crucial for advocating for Mathesar's broader adoption within my team.

Together, these issues form a significant barrier to adopting Mathesar in our environment, as the initial setup requirements do not align with our operational and security standards.

Proposed Solution

Implement a full read-only mode in Mathesar that allows it to connect to a production read replica without needing to install or modify any schemas. I am willing to accept a slight performance hit if necessary to enable this functionality.

Additional Context

The ability to operate in a read-only mode is critical for us as it aligns with our database management and security protocols. This feature would allow us to utilize Mathesar for reporting and analysis without altering the underlying database structure or permissions.

@arvindamirtaa arvindamirtaa added needs: triage This issue has not yet been reviewed by a maintainer type: enhancement New feature or request labels May 10, 2024
@kgodey kgodey added user reported Reported by a Mathesar user needs: requirements The problem is clear and worth solving, but we're not yet sure of the best solution needs: implementation specs We need clarity on HOW we'll implement it from a technical perspective work: backend Related to Python, Django, and simple SQL work: db-layer Related to SQL or PL/pgSQL and removed needs: triage This issue has not yet been reviewed by a maintainer labels May 11, 2024
@kgodey kgodey added this to the High priority milestone May 11, 2024
@kgodey
Copy link
Contributor

kgodey commented May 11, 2024

Thanks for reporting this, @arvindamirtaa. We've had several discussions within the team about enabling this exact workflow, and are in the process of overhauling our permissions for our beta release.

@pavish @ghislaineguerin Tagging you here since we probably want to consider the UX of setting up Mathesar with a default read-only role (as well as other lower privilege roles) as part of the permissions work.

@mathemancer
Copy link
Contributor

mathemancer commented May 14, 2024

I strongly suggest using Postgres's FDW functionality to enable this, with Mathesar's user DB being installed on the internal DB. I don't think we'd do this by beta.

Edit: I did a quick experiment to see what our current level of support is for FDWs. It's not great, I'm afraid. However, we're overhauling some backend pieces in a way that may let us expose tables imported via an FDW for free. If that's the case, you'd be able to achieve the setup you're describing by wiring up the FDW yourself on Mathesar's internal DB, and then just using Mathesar on the internal database.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: implementation specs We need clarity on HOW we'll implement it from a technical perspective needs: requirements The problem is clear and worth solving, but we're not yet sure of the best solution type: enhancement New feature or request user reported Reported by a Mathesar user work: backend Related to Python, Django, and simple SQL work: db-layer Related to SQL or PL/pgSQL
Projects
None yet
Development

No branches or pull requests

3 participants