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

Pass data about the internal DB connection to the front end via common_data #3292

Closed
Tracked by #3294
seancolsen opened this issue Nov 3, 2023 · 0 comments · Fixed by #3299
Closed
Tracked by #3294

Pass data about the internal DB connection to the front end via common_data #3292

seancolsen opened this issue Nov 3, 2023 · 0 comments · Fixed by #3299
Assignees
Labels
ready Ready for implementation restricted: maintainers Only maintainers can resolve this issue type: enhancement New feature or request work: backend Related to Python, Django, and simple SQL
Milestone

Comments

@seancolsen
Copy link
Contributor

seancolsen commented Nov 3, 2023

Mathesar stores its metadata within a Django "internal database". The connection to this database is defined via environment variables, and it can either be a PostgreSQL connection or a file path to a SQLite database.

In the "New DB Connection" form, the front end needs to know some details about this internal database connection in order to render the form.

The backend should put this internal_database field into the "common_data" bundle injected into the front end. As such, we should not need any API modifications to pass this data to the front end.

When using SQLite, the backend should pass this data to the front end:

{
  // other common_data properties here
  // ...
  "internal_database": {
    "type": "sqlite"
  }
}

When using Postgres, the backend should pass data like this:

{
  // other common_data properties here
  // ...
  "internal_database": {
    "type": "postgres",
    "user": "mathesar",
    "host": "localhost",
    "port": "5432",
    "database": "mathesar_django"
  }
}

When "type" is "postgres", all remaining properties as exemplified above must be present and must be strings (i.e. not null).

@seancolsen seancolsen added restricted: maintainers Only maintainers can resolve this issue ready Ready for implementation type: enhancement New feature or request work: backend Related to Python, Django, and simple SQL labels Nov 3, 2023
@seancolsen seancolsen added this to the v0.1.4 milestone Nov 3, 2023
@Anish9901 Anish9901 self-assigned this Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready Ready for implementation restricted: maintainers Only maintainers can resolve this issue type: enhancement New feature or request work: backend Related to Python, Django, and simple SQL
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

2 participants