Skip to content

Commit 69ef01b

Browse files
committed
Merge branch 'develop' into user-type
2 parents ec4184b + ded9800 commit 69ef01b

File tree

317 files changed

+8341
-4142
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

317 files changed

+8341
-4142
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ Temporary Items
181181
.media/
182182
.secrets/
183183
docs/_build/
184+
msar/
184185

185186
## yaml config files ##
186187
sso.yml

CONTRIBUTING.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ Mathesar's development happens on [GitHub](https://github.com/mathesar-foundatio
66

77
## Joining the Community
88

9-
We highly recommend joining our [Matrix community](https://wiki.mathesar.org/en/community/matrix) and our [developer mailing list](https://wiki.mathesar.org/en/community/mailing-lists) before making contributions. This is where most of the core team's conversations about building Mathesar happen.
9+
We highly recommend joining our [Matrix community](https://wiki.mathesar.org/community/matrix) and our [developer mailing list](https://wiki.mathesar.org/community/mailing-lists) before making contributions. This is where most of the core team's conversations about building Mathesar happen.
1010

1111
## Contributing code
1212

1313
1. **Get Mathesar [running locally](./DEVELOPER_GUIDE.md#local-development-setup).**
1414

15-
Make sure to **do this before moving on**. If you need help, ask in [Matrix](https://wiki.mathesar.org/en/community/matrix), taking care to form *specific* questions that people can answer asynchronously.
15+
Make sure to **do this before moving on**. If you need help, ask in [Matrix](https://wiki.mathesar.org/community/matrix), taking care to form *specific* questions that people can answer asynchronously.
1616

1717
1. **Find an [issue](https://github.com/mathesar-foundation/mathesar/issues) to work on.**
1818

@@ -21,7 +21,7 @@ We highly recommend joining our [Matrix community](https://wiki.mathesar.org/en/
2121
- ❌ If an issue is _not_ labeled "help wanted", then it is not open to community contribution. One of the Mathesar maintainers will work on it instead.
2222
- ❌ Issues already assigned to other users are also not open to contribution.
2323

24-
If you want to work on something for which there is no GitHub issue open yet, [create an issue](https://github.com/mathesar-foundation/mathesar/issues/new/choose) and propose your change there. A Mathesar [team member](https://wiki.mathesar.org/en/team) will evaluate your issue and decide whether we'll accept a pull request for the issue.
24+
If you want to work on something for which there is no GitHub issue open yet, [create an issue](https://github.com/mathesar-foundation/mathesar/issues/new/choose) and propose your change there. A Mathesar [team member](https://wiki.mathesar.org/team) will evaluate your issue and decide whether we'll accept a pull request for the issue.
2525

2626
1. ***(Optionally)* Claim the issue.**
2727

@@ -56,7 +56,7 @@ We highly recommend joining our [Matrix community](https://wiki.mathesar.org/en/
5656

5757
## Contributing PR reviews
5858

59-
We encourage and appreciate code review by contributors. Feel free to review any open pull requests. Follow our [code review guidelines](https://wiki.mathesar.org/en/engineering/code-review).
59+
We encourage and appreciate code review by contributors. Feel free to review any open pull requests. Follow our [code review guidelines](https://wiki.mathesar.org/engineering/code-review).
6060

6161
## Contributing documentation
6262

@@ -68,5 +68,5 @@ We encourage and appreciate code review by contributors. Feel free to review any
6868

6969
Due to limited capacity, we are currently unable to accept design volunteers. Please return to this page for updates.
7070

71-
Please read through our [Design](https://wiki.mathesar.org/en/design) section to learn more about our design process.
71+
Please read through our [Design](https://wiki.mathesar.org/archive/product/design/) section to learn more about our design process.
7272

Caddyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
file_server {
1414
precompressed br zstd gzip
15-
root {$MEDIA_ROOT:/code/media/}
15+
root {$MEDIA_ROOT:/code/.media/}
1616
}
1717
}
1818
handle_path /static/* {

README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
<a href="https://mathesar.org?ref=github-readme" target="_blank">Website</a> • <a href="https://docs.mathesar.org?ref=github-readme-top" target="_blank">Docs</a> • <a href="https://wiki.mathesar.org/en/community/matrix" target="_blank">Matrix (chat)</a> • <a href="https://discord.gg/enaKqGn5xx" target="_blank">Discord</a> • <a href="https://wiki.mathesar.org/" target="_blank">Contributor Wiki</a> • <a href="https://github.com/orgs/mathesar-foundation/projects/2" target="_blank">Roadmap</a>
1313
</p>
1414

15-
1615
# Mathesar
16+
1717
Mathesar is a web application that makes working with PostgreSQL databases both simple and powerful. It empowers users of all technical skill levels to view, edit, query, and collaborate on data with a familiar spreadsheet-like interface—no code needed. It’s self hosted, can be deployed in minutes, and works directly with PostgreSQL databases, schemas, and tables without extra abstractions. The project is 100% open source and maintained by Mathesar Foundation, a 501(c)(3) nonprofit.
1818

1919
Mathesar is as scalable as Postgres and supports any size or complexity of data, making it ideal for workflows involving production databases. It requires minimal setup, and integrates into your existing infrastructure. Because Mathesar is self-hosted, your data never leaves your servers, and access control based on Postgres roles and privileges keeps your database secure without adding unnecessary risk.
@@ -36,6 +36,8 @@ Mathesar is as scalable as Postgres and supports any size or complexity of data,
3636
- [Linking two tables together](#linking-two-tables-together)
3737
- [Managing table permissions](#managing-table-permissions)
3838
- [Viewing a single record with related records](#viewing-a-single-record-with-related-records)
39+
- [Building a form](#building-a-form)
40+
- [Filling out a form](#filling-out-a-form)
3941
- [Viewing an Exploration (query result)](#viewing-an-exploration-query-result)
4042
- [Building an Exploration (query)](#building-an-exploration-query)
4143
- [Disconnecting a database](#disconnecting-a-database)
@@ -47,22 +49,27 @@ Mathesar is as scalable as Postgres and supports any size or complexity of data,
4749
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
4850

4951
## Status
52+
5053
- [x] **Public Alpha**: You can install and deploy Mathesar on your server. Go easy on us!
5154
- [x] **Public Beta**: Stable and feature-rich enough to implement in production
5255
- [ ] **Public**: Widely used in production environments
5356

5457
We are currently in the **public beta** stage.
5558

5659
## Install Mathesar
60+
5761
Please see [our documentation](https://docs.mathesar.org/?ref=github-readme-installing) for instructions on installing Mathesar on your own server.
5862

5963
## Join our community
64+
6065
The Mathesar team is on [Matrix](https://wiki.mathesar.org/en/community/matrix) (chat service). We also have [mailing lists](https://wiki.mathesar.org/en/community/mailing-lists) and the core team discusses day-to-day work on our developer mailing list.
6166

6267
### Contribute to Mathesar
68+
6369
We actively encourage contribution! Get started by reading our [Contributor Guide](./CONTRIBUTING.md).
6470

6571
## Features
72+
6673
- **Built on Postgres**: Connect to an existing Postgres database or set one up from scratch.
6774
- **Install in minutes**: Install using Docker in minutes, integrate into any existing infrastructure.
6875
- **Postgres-based access control**: Use existing Postgres roles within Mathesar's UI, or set up your own.
@@ -71,13 +78,16 @@ We actively encourage contribution! Get started by reading our [Contributor Guid
7178
- **Data entry**: Use our spreadsheet-like interface to view, create, update, and delete table records.
7279
- **Filter, sort, and group**: Quickly slice your data in different ways.
7380
- **Query builder**: Use our Data Explorer to build queries without knowing anything about SQL or joins.
81+
- **Forms**: Build and share forms to collect data from anyone via a unique link, with submissions automatically saved as new records.
7482
- **Import and export data**: Import and export data into Mathesar easily to work with your data elsewhere.
7583
- **Schema migrations**: Transfer columns between tables in two clicks.
7684
- **Uses Postgres features**: Mathesar uses and manipulates Postgres schemas, primary keys, foreign keys, constraints and data types. e.g. "Relationships" in the UI are foreign keys in the database.
7785
- **Custom data types**: Custom data types for emails and URLs, validated at the database level.
7886

7987
## Screenshots
88+
8089
### Connecting a database
90+
8191
![connect-db](https://github.com/user-attachments/assets/d7188c8d-a040-4bc4-8350-28b2a6fd1661)
8292

8393
### Adding collaborators
@@ -101,6 +111,12 @@ We actively encourage contribution! Get started by reading our [Contributor Guid
101111
### Viewing a single record with related records
102112
![record-page](https://github.com/user-attachments/assets/d2e621e3-5597-44ef-ae87-482bec0b9bcc)
103113

114+
### Building a form
115+
![form-builder](https://raw.githubusercontent.com/mathesar-foundation/mathesar/develop/docs/docs/assets/releases/0.5.0/form-builder.png)
116+
117+
### Filling out a form
118+
![form-fill-example](https://raw.githubusercontent.com/mathesar-foundation/mathesar/develop/docs/docs/assets/releases/0.5.0/form-fill-example.png)
119+
104120
### Viewing an Exploration (query result)
105121
![viewing-exploration](https://github.com/user-attachments/assets/410cb99f-a583-411b-9706-7967bff673e6)
106122

@@ -111,15 +127,19 @@ We actively encourage contribution! Get started by reading our [Contributor Guid
111127
![disconnect-db](https://github.com/user-attachments/assets/f22e9c78-3c92-40c8-8ef9-dcb4cf8e8aea)
112128

113129
## Mathesar in action
130+
114131
https://github.com/user-attachments/assets/6bdfb178-17b4-4abf-aac4-9781e1d841ab
115132

116133
## Our motivation
134+
117135
Using databases shouldn't require technical expertise or expensive, closed-off tools. Databases are incredibly powerful, but they're often trapped behind complex interfaces that are hard to use or limit how people can access and share their data. We want to change that by building user-friendly tools that unlock the power of existing databases without sacrificing accessibility, portability, or extensibility.
118136

119137
Mathesar is our answer: an open-source platform designed to unlock the full potential of PostgreSQL, one of the most powerful and trusted open-source databases. Mathesar is easy to use, interoperable, and extensible, while also giving you complete control over your data. As a nonprofit, we're committed to keeping Mathesar 100% open source and available to everyone—because better ways to work with data mean better decisions, and better decisions lead to a better world.
120138

121139
## Bugs and troubleshooting
140+
122141
If you run into problems, refer to our [troubleshooting guide](./TROUBLESHOOTING.md).
123142

124143
## License
144+
125145
Mathesar is open source under the GPLv3 license - see [LICENSE](LICENSE). It also contains derivatives of third-party open source modules licensed under the MIT license. See the list and respective licenses in [THIRDPARTY](THIRDPARTY).

config/database_config.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def to_django_dict(self) -> Dict[str, Any]:
9999
@dataclass(frozen=True)
100100
class PostgresConfig(DBConfig):
101101
engine: str = POSTGRES_ENGINE
102-
sslmode: Optional[str] = None
102+
sslmode: str = "prefer"
103103

104104
# Inject sslmode into OPTIONS
105105
# https://www.postgresql.org/docs/current/libpq-ssl.html#LIBPQ-SSL-PROTECTION
@@ -115,7 +115,9 @@ def from_connection_string(cls, url: str) -> "PostgresConfig":
115115
params = conninfo.conninfo_to_dict(url)
116116
dbname = params.get("dbname")
117117
if not dbname:
118-
raise ValueError("PostgresConfig.from_connection_string: missing database name in URL")
118+
raise ValueError(
119+
"PostgresConfig.from_connection_string: missing database name in URL"
120+
)
119121

120122
return cls(
121123
dbname=dbname,
@@ -129,7 +131,7 @@ def from_connection_string(cls, url: str) -> "PostgresConfig":
129131
@classmethod
130132
def from_django_dict(cls, cfg: Mapping[str, Any]) -> "PostgresConfig":
131133
raw_opts = cfg.get("OPTIONS", {}).copy()
132-
sslmode = raw_opts.pop("sslmode", None)
134+
sslmode = raw_opts.pop("sslmode", "prefer")
133135
base_cfg = dict(cfg, OPTIONS=raw_opts)
134136
base = super().from_django_dict(base_cfg)
135137
return replace(base, sslmode=sslmode)

config/settings/common_settings.py

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@
3535
"django.contrib.messages",
3636
"whitenoise.runserver_nostatic",
3737
"django.contrib.staticfiles",
38-
"rest_framework",
39-
"django_filters",
40-
"django_property_filter",
4138
"modernrpc",
4239
"mathesar",
4340
"allauth",
@@ -208,6 +205,7 @@
208205
POSTGRES_PASSWORD = os.environ.get('POSTGRES_PASSWORD', default=None)
209206
POSTGRES_HOST = os.environ.get('POSTGRES_HOST', default=None)
210207
POSTGRES_PORT = os.environ.get('POSTGRES_PORT', default=None)
208+
POSTGRES_SSLMODE = os.environ.get('POSTGRES_SSLMODE', default='prefer')
211209

212210
# POSTGRES_DB, POSTGRES_USER, and POSTGRES_HOST are required env variables for forming a pg connection string for the django database
213211
if POSTGRES_DB and POSTGRES_USER and POSTGRES_HOST:
@@ -217,6 +215,7 @@
217215
port=parse_port(POSTGRES_PORT),
218216
role=POSTGRES_USER,
219217
password=POSTGRES_PASSWORD,
218+
sslmode=POSTGRES_SSLMODE,
220219
).to_django_dict()
221220
DATABASES['default']['OPTIONS'] = {
222221
"application_name": "Mathesar Django"
@@ -302,35 +301,12 @@
302301

303302
MEDIA_URL = "/media/"
304303

305-
# Update Authentication classes, removed BasicAuthentication
306-
# Defaults: https://www.django-rest-framework.org/api-guide/settings/
307-
REST_FRAMEWORK = {
308-
'DEFAULT_AUTHENTICATION_CLASSES': [
309-
'rest_framework.authentication.TokenAuthentication',
310-
'rest_framework.authentication.SessionAuthentication'
311-
],
312-
'DEFAULT_PERMISSION_CLASSES': [
313-
'rest_framework.permissions.IsAuthenticated',
314-
],
315-
'DEFAULT_PARSER_CLASSES': [
316-
'rest_framework.parsers.JSONParser',
317-
],
318-
'DEFAULT_FILTER_BACKENDS': (
319-
'django_filters.rest_framework.DjangoFilterBackend',
320-
'rest_framework.filters.OrderingFilter',
321-
),
322-
'TEST_REQUEST_DEFAULT_FORMAT': 'json',
323-
'EXCEPTION_HANDLER':
324-
'mathesar.exception_handlers.mathesar_exception_handler',
325-
}
326-
327304
# Mathesar settings
328305
MATHESAR_MODE = os.environ.get('MODE', default='PRODUCTION')
329306
MATHESAR_UI_BUILD_LOCATION = os.path.join(BASE_DIR, 'mathesar/static/mathesar/')
330307
MATHESAR_MANIFEST_LOCATION = os.path.join(MATHESAR_UI_BUILD_LOCATION, 'manifest.json')
331308
MATHESAR_CLIENT_DEV_PORT = os.environ.get('MATHESAR_CLIENT_DEV_PORT', default='3000')
332309
MATHESAR_UI_SOURCE_LOCATION = os.path.join(BASE_DIR, 'mathesar_ui/')
333-
MATHESAR_CAPTURE_UNHANDLED_EXCEPTION = os.environ.get('CAPTURE_UNHANDLED_EXCEPTION', default=False)
334310
MATHESAR_STATIC_NON_CODE_FILES_LOCATION = os.path.join(BASE_DIR, 'mathesar/static/non-code/')
335311
MATHESAR_ANALYTICS_URL = os.environ.get('MATHESAR_ANALYTICS_URL', default='https://example.com/collector')
336312
MATHESAR_INIT_REPORT_URL = os.environ.get('MATHESAR_INIT_REPORT_URL', default='https://example.com/hello')
@@ -349,9 +325,7 @@
349325
LOGIN_URL = '/auth/login/'
350326
LOGIN_REDIRECT_URL = '/'
351327
LOGOUT_REDIRECT_URL = LOGIN_URL
352-
DRF_ACCESS_POLICY = {
353-
'reusable_conditions': ['mathesar.api.permission_conditions']
354-
}
328+
355329
# List of Template names that contains additional script tags to be added to the base template
356330
BASE_TEMPLATE_ADDITIONAL_SCRIPT_TEMPLATES = []
357331

config/urls.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
urlpatterns = [
2323
path('admin/', admin.site.urls),
2424
path('', include(mathesar_urls)),
25-
path('api-docs/', include('rest_framework.urls')),
2625
]
2726

2827
handler404 = 'mathesar.views.page_not_found_view'

db/identifiers.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,8 @@ def truncate_if_necessary(identifier):
3333

3434

3535
def is_identifier_too_long(identifier):
36-
# TODO we should support POSTGRES_IDENTIFIER_SIZE_LIMIT here;
37-
# Our current limit due to an unknown bug that manifests at least
38-
# when importing CSVs seems to be 57 bytes. Here we're setting it even
39-
# lower just in case.
40-
our_temporary_identifier_size_limit = 48
4136
size = _get_size_of_identifier_in_bytes(identifier)
42-
return size > our_temporary_identifier_size_limit
37+
return size > POSTGRES_IDENTIFIER_SIZE_LIMIT
4338

4439

4540
def _get_truncation_hash(identifier):

db/records.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ def list_records_from_table(
1515
order=None,
1616
filter=None,
1717
group=None,
18+
joined_columns=None,
1819
return_record_summaries=False,
1920
table_record_summary_templates=None,
2021
):
@@ -34,6 +35,8 @@ def list_records_from_table(
3435
order: An array of ordering definition objects.
3536
filter: An array of filter definition objects.
3637
group: An array of group definition objects.
38+
joined_columns: An array of dict(s) that include an "alias" and "join_path" where,
39+
"join_path" represents linkages via a simple many-to-many mapping to a column in another table.
3740
return_record_summaries: Whether to return self record summaries.
3841
table_record_summary_templates: A dict of record summary templates, per table.
3942
"""
@@ -46,6 +49,7 @@ def list_records_from_table(
4649
_json_or_none(order),
4750
_json_or_none(filter),
4851
_json_or_none(group),
52+
_json_or_none(joined_columns),
4953
return_record_summaries,
5054
_json_or_none(table_record_summary_templates),
5155
).fetchone()[0]
@@ -56,6 +60,7 @@ def get_record_from_table(
5660
conn,
5761
record_id,
5862
table_oid,
63+
joined_columns=None,
5964
return_record_summaries=False,
6065
table_record_summary_templates=None,
6166
):
@@ -67,6 +72,8 @@ def get_record_from_table(
6772
Args:
6873
record_id: The primary key value of the record.
6974
table_id: The OID of the table whose record we'll get.
75+
joined_columns: An array of dict(s) that include an "alias" and "join_path" where,
76+
"join_path" represents linkages via a simple many-to-many mapping to a column in another table.
7077
return_record_summaries: Whether to return self record summaries.
7178
table_record_summary_templates: A dict of record summary templates, per table.
7279
"""
@@ -75,6 +82,7 @@ def get_record_from_table(
7582
'get_record_from_table',
7683
table_oid,
7784
record_id,
85+
_json_or_none(joined_columns),
7886
return_record_summaries,
7987
_json_or_none(table_record_summary_templates),
8088
).fetchone()[0]
@@ -126,6 +134,7 @@ def list_by_record_summaries(
126134
offset=0,
127135
search=None,
128136
table_record_summary_templates=None,
137+
linked_record_path=None,
129138
):
130139
result = db_conn.exec_msar_func(
131140
conn,
@@ -135,6 +144,7 @@ def list_by_record_summaries(
135144
offset,
136145
search,
137146
_json_or_none(table_record_summary_templates),
147+
_json_or_none(linked_record_path),
138148
).fetchone()[0]
139149
return result
140150

0 commit comments

Comments
 (0)