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

Mapping DB data types to Mathesar data types #269

Closed
3 tasks done
kgodey opened this issue Jun 18, 2021 · 4 comments
Closed
3 tasks done

Mapping DB data types to Mathesar data types #269

kgodey opened this issue Jun 18, 2021 · 4 comments
Assignees
Labels
ready Ready for implementation type: meta List of related issues. Not meant to be worked on directly. work: backend Related to Python, Django, and simple SQL

Comments

@kgodey
Copy link
Contributor

kgodey commented Jun 18, 2021

We will have "friendly" Mathesar data types to make DB types easier to work with for non-technical users. We'll map DB types to these Mathesar types so that the frontend can show both the DB type and the Mathesar type as appropriate.

We'll expand these over time as we support advanced functionality for more types in Mathesar.

Here's the mapping:

Mathesar Type Postgres Types
number NUMERIC, SMALLINT, INTEGER, BIGINT, DECIMAL, REAL, DOUBLE PRECISION, MATHESAR_TYPES.PERCENTAGE (Mathesar custom type)
text VARCHAR, CHAR, TEXT
datetime TIMESTAMP, DATE, TIME
duration INTERVAL
boolean BOOLEAN
other SMALLSERIAL, SERIAL, BIGSERIAL, BYTEA, POINT,LINE,LSEG,BOX,PATH,PATH,POLYGON, CIRCLE, CIDR, INET, MACADDR, MACADDR8, BIT, BIT VARYING, TSQUERY, TSVECTOR, JSON, JSONB, XML, PG_LSN, PG_SNAPSHOT, TXID_SNAPSHOT, INT4RANGE, INT8RANGE, NUMRANGE, TSRANGE, TSTZRANGE, DATERANGE
money MATHESAR_TYPES.MONEY (Mathesar custom type), MONEY
email MATHESAR_TYPES.EMAIL (Mathesar custom type)
uri MATHESAR_TYPES.URI (Mathesar custom type)
custom Any type that's detected but not on the list above.

Mathesar types should be owned by the Mathesar web service.

To implement this issue, we need to:

@kgodey kgodey added this to the 8. Initial Data Types milestone Jun 18, 2021
@kgodey kgodey self-assigned this Jun 18, 2021
@kgodey kgodey added the restricted: maintainers Only maintainers can resolve this issue label Jun 18, 2021
@mathemancer
Copy link
Contributor

Note for whenever we do flesh this out: The current table reflection logic results in any type in the DB being reflected in the API, including (for example) custom user-created types, as well as any types they have installed through extensions. We should try to come up with some "nice" way to handle those along with more properly supported types.

@kgodey kgodey added work: backend Related to Python, Django, and simple SQL ready Ready for implementation work: database and removed restricted: maintainers Only maintainers can resolve this issue status: detail needed labels Jul 7, 2021
@kgodey kgodey removed their assignment Jul 7, 2021
@kgodey kgodey changed the title Mapping DB data types to human-friendly data types Mapping DB data types to Mathesar data types Jul 14, 2021
@ghislaineguerin
Copy link
Contributor

@kgodey this makes sense to me. When they add a database to mathesar, are we converting any of their types? Do we want users to know the specific number type their data had or just default to number.

@kgodey
Copy link
Contributor Author

kgodey commented Jul 15, 2021

@ghislaineguerin "Mathesar Types" are purely to make things more user friendly on the frontend; their data is always stored in one of the Postgres types. There won't be any conversion.

We do want users to be able to see the specific number type the data is stored in, but it can be hidden by default unless people want to see it. This is a design decision we need to make.

@kgodey
Copy link
Contributor Author

kgodey commented Aug 16, 2021

Closing this since all sub-issues are closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready Ready for implementation type: meta List of related issues. Not meant to be worked on directly. work: backend Related to Python, Django, and simple SQL
Projects
No open projects
Development

No branches or pull requests

3 participants