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

Create URI custom type and handle it in the backend. #412

Closed
Tracked by #246
kgodey opened this issue Jul 16, 2021 · 5 comments · Fixed by #692
Closed
Tracked by #246

Create URI custom type and handle it in the backend. #412

kgodey opened this issue Jul 16, 2021 · 5 comments · Fixed by #692
Assignees
Labels
type: enhancement New feature or request work: backend Related to Python, Django, and simple SQL

Comments

@kgodey
Copy link
Contributor

kgodey commented Jul 16, 2021

This issue is to set up a data type to work with URIs. We might choose to use an existing extension like https://github.com/petere/pguri or write our own MATHESAR_TYPES.URI type. Part of this issue involves evaluating both options.

As part of this issue, we need to do the following:

  • Decide which approach to take – use pguri or write our own. @kgodey and @mathemancer should sign off before implementation.
  • If we're using our own custom type, implement the MATHESAR_TYPES.URI custom type.
    • The type should be case-insensitive at the DB layer and uppercase in the API
  • Ensure that users can use the API to change a column to the URI type if it's possible to do so.
  • Set up automatic type inference during file import to suggest the URI type when it makes sense to do so.

Additional Context

@kgodey kgodey changed the title Create MATHESAR_URI custom type and handle it in the backend. Create URI custom type and handle it in the backend. Jul 16, 2021
@kgodey kgodey added ready Ready for implementation type: enhancement New feature or request work: backend Related to Python, Django, and simple SQL work: database labels Jul 16, 2021
@kgodey kgodey added this to the 07. Initial Data Types milestone Jul 16, 2021
@mathemancer
Copy link
Contributor

If we can spare the time for implementation, I suggest we implement our own. This would avoid the need for installing a 3rd-party extension which isn't supported everywhere (e.g., on Amazon's RDS instances).

@kgodey
Copy link
Contributor Author

kgodey commented Jul 19, 2021

pguri is not on AWS's supported extension list.

We might still want to use it to speed up implementation and consider writing our own at a later date. It depends on how much work it is to write our own. We could also try using/forking pguri as a starting point if we're writing our own.

@mathemancer
Copy link
Contributor

Looking at the filtering / grouping requirements, we should be able to get away with a DOMAIN combined with a couple of splitting functions, very similar to our current implementation of the EMAIL type. I don't think it would be too difficult.

The pguri extension defines the type in C, so I don't think it will be too useful to start from if we want to implement our own. (In fact, even the regexes, etc. for identifying URIs are included in that C file, so they're not visible there.)

@kgodey
Copy link
Contributor Author

kgodey commented Jul 20, 2021

@mathemancer makes sense. I do want to make it easy to extend to other URI parts in the future e.g. pguri supports port, query parameters, fragments, etc. (see docs).

@mathemancer
Copy link
Contributor

@mathemancer makes sense. I do want to make it easy to extend to other URI parts in the future (e.g. pguri supports port, query parameters, fragments, etc. (see docs).

I do think it makes sense to try to use that extension (and other URI-mangling libraries) as inspiration at least. I just wish there was a good way to install extensions without access to the underlying server.

@kgodey kgodey added needs: unblocking Blocked by other work and removed ready Ready for implementation labels Jul 20, 2021
@kgodey kgodey added ready Ready for implementation and removed needs: unblocking Blocked by other work labels Aug 17, 2021
@mathemancer mathemancer mentioned this issue Oct 4, 2021
7 tasks
@kgodey kgodey added status: started and removed ready Ready for implementation labels Oct 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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