Show HN: Mathesar – open-source collaborative UI for Postgres databases (github.com)
Mathesar is an open source tool that provides a spreadsheet-like interface to a PostgreSQL database.
I was originally inspired by wanting to build something like Dabble DB. I was in awe of their user experience for working with relational data. There’s plenty of “relational spreadsheet” software out there, but I haven’t been able to find anything with a comparable UX since Twitter shut Dabble DB down.
We're a non-profit project. The core team is based out of a US 501(c)(3).
Features:
* Built on Postgres: Connect to an existing Postgres database or set one up from scratch.
* Utilizes Postgres Features: Mathesar’s UI uses Postgres features. e.g. "Links" in the UI are foreign keys in the database.
* Set up Data Models: Easily create and update Postgres schemas and tables.
* Data Entry: Use our spreadsheet-like interface to view, create, update, and delete table records.
* Data Explorer: Use our Data Explorer to build queries without knowing anything about SQL or joins.
* Schema Migrations: Transfer columns between tables in two clicks in the UI.
* Custom Data Types:: Custom data types for emails and URLs (more coming soon), validated at the database level.
Links:
CODE: https://github.com/centerofci/mathesar
LIVE DEMO: https://demo.mathesar.org/
DOCS: https://docs.mathesar.org/
COMMUNITY: https://wiki.mathesar.org/en/community
WEBSITE: https:/mathesar.org/
SPONSOR US: https://github.com/sponsors/centerofci or https://opencollective.com/mathesar
78 comments
[ 1.9 ms ] story [ 130 ms ] threadSuper interesting, will definitely use it.
PS. I would recommend making the demo account ready-only.
That sounds interesting too.
However, all databases are accessible to the demo user, so if you send a link to someone else, they will see your database (since the URL includes the database identifier).
You can see our code for it here: https://github.com/centerofci/mathesar/tree/develop/demo
[1] https://www.postgresql.org/docs/current/manage-ag-templatedb...
What’s more challenging is handling many concurrent connections as a different database would mandate a separate connection and you can’t perform any meaningful connection pooling.
In Mathesar, we want the abstractions to be as thin as possible, while still giving non-technical users the capability to model and edit their data. You can point Mathesar and an existing Postgres database and, as long as all the foreign keys are in place, you should be able to use it a lot like Airtable. But when you set up a new relationship between tables, you'll find that it works very differently in Mathesar than in basically any other spreadsheet-database hybrid tool.
One-to-many relationships use a foreign key column in one table (instead of in two tables in Airtable). Many-to-many relationships use two FK columns in a join table (instead of by showing a column in each of the two related tables). All of the data is kept normalized. That normalization can make it hard to work with the data though! So we are developing a robust graphical query builder (called the "Data Explorer") which lets you to see data joined across multiple tables.
[0] - I understand that types can be added on top, but I never found the integration to work that well with mypy when I last tried it many years ago.
Personally, I love types! (Can you tell that I'm on the front end team??) I used mypy extensively at my last job and liked it okay, but mypy is just not as nice as TypeScript. It's come a long way, but it can still be pretty cumbersome. TypeScript on the other hand is fantastic. I'm certainly never going back to JavaScript. But to get back to your original question: yes, for me using TypeScript has changed my tendency to use Python for other tasks. I just don't want to use Python as much. For backend work, I'd reach either for TypeScript, or for Rust. But keep in mind I'm just a front end dev! :)
[0]: https://mathesar.org/about.html [1]: https://github.com/centerofci/mathesar/discussions/913
There's something to be said about balancing what's interesting and what's accessible. If anyone has stories to share, I'd love to hear it.
Have you ever tried [Pydantic](https://docs.pydantic.dev)!? It may be what you need for type safety / data validation.
icontract and pycontracts (Design-by-Contract programming) have runtime type and constraint checking; data validation. Preconditions, Command, Postconditions (assertions, assertions of invariance after command C_funcname executed) https://github.com/Parquery/icontract
pydantic_schemaorg: https://github.com/lexiq-legal/pydantic_schemaorg
> Pydantic_schemaorg contains all the models defined by schema.org. The pydantic classes are auto-generated from the schema.org model definitions that can be found on https://schema.org/version/latest/schemaorg-current-https.js... [ https://github.com/schemaorg/schemaorg/tree/main/data/releas... ]
I wouldn't try and write a decent-sized Python project without typing now.
I'm jumping into a django/react project right now and found that there's so much hassle from integrating frontend + django + livereload + deployment. This repo is a good example.
This might be the first free, user-friendly interface for Postgres out there. Closest would be TablePlus but it’s paid.
Unlike SequelPro and TablePlus, we're a web application (although we do want to do a desktop version eventually). And Mathesar works even if you don't have an existing DB to connect to – you can set up a DB from scratch during installation.
EDIT: demo server is back up.
An optimized hosted version with permalinks to Explorer views would open access to even more users.
A hosted version is definitely on our plans for Mathesar, and being able to share tables and explorations publicly via a permalink is part of our roadmap[1][2].
[1] https://mathesar.org/roadmap.html [2] https://github.com/centerofci/mathesar/discussions/2266
My previous job was in a biggish e-commerce company and the business teams would send spreadsheets with corrections to the data (like updating descriptions, changes in pricing etc.,) almost every day, and the developers had to make those changes in production.
We ended up building an inhouse application to let the product team edit production data directly, with some restrictions. One of Mathesar's goals is to solve collaboration issues like these.
Mathesar allows setting up users with different access levels[1], so it's easier to create users with limited access. As part of our roadmap[2], we also intend to allow configuring permissions at a more granular level, such as row & column level access to tables. So, developers could breathe freely when providing business teams access to the underlying database.
[1] https://docs.mathesar.org/product/users/ [2] https://mathesar.org/roadmap.html
Schema migrations should go via CI/CD and data changes via your app.
Otherwise it’s gets messy indeed.
I agree you shouldn't allow users to change the schema if you're connecting Mathesar to a production database (that would mess a lot of things up!) We've designed our user roles to account for this – you would assign "Editor" permissions to users, and they can only edit data, but not change anything related to the structure.
On the other hand, if you're using Mathesar as your primary tool to work with your data, it's really nice to be able to change the schema to align with changes in your mental models or workflows.
Originally, Mathesar was just an internal codename (we needed to name the repo something), but we decided to stick with it.
We also intend to release our Svelte component-library as a separate package and considering if we should establish a GalaxyQuest theme when naming it, perhaps Laliari.
Here's the discussion: https://github.com/centerofci/mathesar/discussions/833
This is exactly what I've been looking for (but now I'm heavily invested in a full fledged CRM)!
Thank you for this
Then I saw - its actually built on Django! Neat. :)
Specifically, I've been in the market for a while now for a webapp you can run on a server, that presents a UX for submitting, watching the progress, and managing, long-running schema changes / data migrations (think: index creations, table re-partitionings) that have been written out as long screeds of custom SQL, and then either submitted through said UI, or which are uploaded to the server out-of-band and then pointed at. (And also, support for kicking off + observing + managing native DB-server commands like Postgres's `vacuumdb --analyze-only` or `pg_dump` / `pg_restore`, and relating them to their DB activity.)
Ideally, the UX would be designed so that you could have many of these jobs running in parallel, without everything descending into incoherence. (I'm picturing: the UI of a torrent client. A table of progress bars + error counts; click in to see the SQL execution log and per-job metrics.)
Ideally also, there'd be a library of SQL templates you could create, where you could generate and fire off N parallel copies of a query with the template-variables populated from some combination of running other SQL queries, and supplied static lists of values; with the meta-job having a configurable max concurrency limit for how many concrete jobs it will ask the DB to schedule at once, separate from the max concurrency of jobs in the DB generally.
Maybe as well, some macro-language for those templates, to let you write "if table_exists(foo), do: [sql], else: [other sql]", or "create_index_if_none_satisfy(table, {colA, colB})", etc — rather than having to look up the unintuitive tables and columns in ANSI-SQL INFORMATION_SCHEMA for the Nth time to then write either "compile-time" SQL or sproc SQL to get this effect.
Right now at $JOB we're doing this kind of thing ad-hoc, by writing scripts that take arguments and query the DB to generate directories full of .sql files, that we then run concurrently using shuf(1), split(1), bash for loops, and named shared tmux(1) sessions; and then visualizing progress in various weak ways, e.g. querying `pg_stat_progress_create_index` during index creation.
I like the idea of being able to track multiple data migrations or schema changes in parallel. We do currently support basic point-and-click DDL, and the data gets migrated when you (for example) set up a linked table based on some columns from an initial table, but we don't really have a way to track multiple such requests in one view.
I suppose one general solution would be to provide a UI for `pg_stat_activity` or other similar system tables that lets you filter easily.
It's also not free and breaks in all kinds of fun ways.
Feature request: historical tracking. E.g. on update, expire the old record with who & when.
We have had discussions regarding auditing in Mathesar[1], though it's not explicitly documented in the roadmap yet. We do have plans to implement Undo & Redo support for data editing operations in our roadmap[2] which would depend on the auditing implementation.
[1] https://github.com/centerofci/mathesar/discussions/113#discu... [2] https://mathesar.org/roadmap.html
We've documented the differences between Mathesar and other similar products including NocoDB on the FAQ section[1] in our website.
[1] https://mathesar.org/faq.html#how-is-mathesar-different-from...
A feature to build interfaces for internal admin tools sounds very cool, and while we cannot say that it's coming for sure, we'll definitely be discussing it. Please feel free to open a feature request issue on our Github repo, we'd appreciate it.
I tried the install script and it asked me for my computer password. It feels really dangerous to give a random script from the internet my password. Could you maybe change this, so this is not necessary?
So elevated privileges are needed because we're installing using Docker Compose and you can't use Docker without some form of elevated privileges (most people always run it with sudo). MacOS is a slightly different story, but anyway.
The reason we use Docker Compose is because we need to not only deploy Mathesar, but also a Postgres database (if you're not using your own), and we want maximally simple installs and in-app upgrading (upgrading is implemented via Watchtower, which is basically fancy docker pulls with automatic container restarts).
[1] https://github.com/centerofci/mathesar/issues/2427
I also know of another similar project heavily utilizing RLS where end users actually have a 1:1 database user with access to their own data, here something like Mathesar could be nice as well if it would play nice with ACL/RLS.
[1] https://mathesar.org/roadmap.html
[1] https://mathesar.org/roadmap.html
Really polished. Congrats on the launch!
Either way, really stoked for this.
I did try with some of the smaller sets, though, and they seem to work. An advantage of Mathesar is that you can always self-host, and provision enough resources for whatever data size you have!
Here's the issue that tracks it: https://github.com/centerofci/mathesar/issues/2634
Thanks!