Giter Site home page Giter Site logo

tapis-project / paas Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 369 KB

The PgREST service provides a friendly RESTful API to a managed Postgres database with management tools for tables, views, and roles.

Home Page: https://tapis.readthedocs.io/en/latest/technical/pgrest.html

Dockerfile 0.30% Python 95.93% Makefile 0.77% Jupyter Notebook 2.92% Shell 0.07%

paas's People

Contributors

branritz avatar github-actions[bot] avatar joestubbs avatar notchristiangarcia avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

paas's Issues

Feature request: Complex view support

I like the straightforward approach to setting up views in the current pgrest, but oftentimes views are based on some pretty complex SQL queries (including joins, conditionals, aggregations, etc) that might be hard to implement using a declarative form like we do for table creation, etc. I would like to propose allowing the user to provide something approximating raw SQL for the view definition. This would be an alternative to the simpler (and easier-to-use) form that is supported now.

Deployer QOL fixes.

New Github deployment actions and change startup fails so they don't cause issue. Previously role creation was breaking when attempting to create roles on other sites. Nginx routing is also working again, thanks to Smruti.

Feature request: Bulk row creation

To optimize larger data load operations, I am suggesting development of a feature allowing creation of multiple rows in a single action.

The current API supports POST of a JSON doc structured as below, returning the newly created row as a TapisResult.

{
    "data": {
      "name": "example-widget",
      "widget_type": "gear",
      "count": 0,
      "is_private": false
    }
}

Maybe it would work to support posting a structure like this to load multiple rows at once:

{
	"data": [{
		"name": "example-widget",
		"widget_type": "gear",
		"count": 0,
		"is_private": false
	}, {
		"name": "example-widget-2",
		"widget_type": "gear",
		"count": 1,
		"is_private": false
	}, {
		"name": "example-widget-3",
		"widget_type": "gear",
		"count": 4,
		"is_private": false
	}]
}

The response from the service would be the list of created rows (as TapisResults).

To make this bulk insert an atomic operation, the entire set of row adds could be wrapped in a single transaction, being rolled back if any of the row creations fail, with the most relevant error being returned as a message from the service.

Extra forward slashes not resolving properly.

Raised by Joshua Urrutia.
PgREST seems to not resolve extra forward slashes in the URL properly. RFC 2396 hints that it should resolve properly.

https://tacc.develop.tapis.io///v3///pgrest

Probably an issue with Django or pattern recognition. Error below.

 'metadata': {},
 'result': None,
 'status': 'error',
 'version': 'dev'}

Support for limit and offset in list_in_collection

According to the OpenAPI spec (and based on functional tests), it seems like limit and offset support are missing from list_in_collection.

tapis3 pg tables list organization
+---------------------------------------+-------+-----------------+----------------------+-------+
| description                           | name  | organization_id | url                  | _pkid |
+---------------------------------------+-------+-----------------+----------------------+-------+
| Data Coordinating Center              | TACC  |               1 | tacc.utexas.edu      |     1 |
| University of Illinois at Chicago     | UIC   |               2 | uic.edu              |     2 |
| Rush University Medical Center        | Rush  |               3 | rush.edu             |     3 |
| Institute for Translational Medicine  | ITM   |               4 | chicagoitm.org       |     4 |
| University of Chicago Medical Center  | UCMC  |               5 | uchicagomedicine.org |     5 |
| NorthShore                            | NS    |               6 | northshore.org       |     6 |
| University of Michigan                | UMICH |               7 | umich.edu            |     7 |
| University of Iowa                    | UIOWA |               8 | uiowa.edu            |     8 |
| Pacific Northwest National Laboratory | PNNL  |               9 | pnnl.gov             |     9 |
| University of California San Diego    | UCSD  |              10 | ucsd.edu             |    10 |
+---------------------------------------+-------+-----------------+----------------------+-------+

There are > 10 records in this collection. Sending a limit kwarg to list_in_collection does not change the response.

Add a comment field for each column

I propose adding an optional short (say 255 char) comment field for each column. This would make PgREST table specs a little more self-documenting. This would make it easy to generate human-usable forms and renderings around PgREST.

Change view implementation for non privileged users.

Currently PGREST_READ is required for views endpoints, meaning that any user can actually see anything else as well.

  • Get rid of PGREST_READ permission on views.
  • Create new unprivileged user so non-PgREST users can't access.
  • Ensure views still work with new role.

Views are not deleted from pgrest_managedviews when view is deleted

When a view is deleted administratively (or by cascading processes in postgresql), the corresponding row in the pgrest_managedviews table is not deleted. This prevents a view with the same name from being created in the future. The current workaround is to manually delete the rows using a DBMS client.

Feature request: Table schema updates

It can be a lot of work to dump, drop, create, and load tables in order to make a trivial update to a schema, especially when there are tables linked by foreign key constraints. Please consider providing support for some degree of dynamic table schema updates.

Feature request: support "order by"

In addition to where, limit, and offset, it would be helpful to support ordering by field name, allowing for specification of ascending or descending sort.

Improvement: Don't enforce "limit" by default on queries

If I am doing a query on a table, I expect to get all the rows back if I do not specify a limit. This is equivalent to FROM table SELECT * WHERE %CRITERA; In the current pgrest implementation, I get the first 10 records back, which was a bit surprising. So, I either have to arbitrarily provide a large value for 'limit or iterate through the responses, which adds at minimum, one additional API call just to do a select-type operation.

Change: Serial data type doesn't imply unique.

Serial columns can be overwritten and then the SERIAL type will overwrite that causing issues for PGREST.

Talked to Matt, will change SERIAL to "start" at integer 1000 instead of 0 to more than likely get rid of any collisions. Will also enforce UNIQUE.

Support for table-level constraints

I am requesting support for table-level constraints. Specifically, and to start with, we need multi-column unique constraints for the A2CPS project. I propose the following extension to the PgREST table definition:

{
	"table_name": "UserProfile",
	"root_url": "user-profile",
	"constraints": {
		"unique": {
			"first_last": ["first_name", "last_name"]
		}
	},
	"columns": {
		"user_profile_id": {
			"data_type": "serial",
			"primary_key": true
		},
		"username": {
			"unique": true,
			"data_type": "varchar",
			"char_len": 255
		},
		"first_name": {
			"null": true,
			"data_type": "varchar",
			"char_len": 255
		},
		"last_name": {
			"null": true,
			"data_type": "varchar",
			"char_len": 255
		}
	}
}

In this trivial example, all User Profile records would be forced have a unique combination of first and last name. On the backend, this would map roughly to:

CREATE UNIQUE INDEX UserProfile_first_last ON UserProfile(first_name, last_name)

Add a comment field for each table

I propose adding an optional short (say 255 char) comment field for each table. This would make PgREST table specs a little more self-documenting. This would make it easy to generate human-usable forms and renderings around PgREST.

Constraints of the same name are currently colliding during table creation.

Specifically declaring a multi-column unique constraint.
ex. 'constraints': {'unique': {'uniqueConstraintName': ['column1', 'column2']}}
A user cannot use the name uniqueConstraintName more than once.

I believe this is the expected outcome, if true at least have a better error message, if not, fix the sql.

Consider changing property name 'FK' to 'foreign_key'

It's not intuitive to me what the property FK is in a table definition. It's (at least in the docs) uppercase and is also an abbreviation unlike the other table properties. I suggest changing the property name to foreign_key.

Feature request: floating point number support

Please consider adding support for one or more postgresql floating point number types... numeric, decimal, real, double precision. It's not straightforward at present to work with these in PgREST.

Dangling view record can't be deleted.

There's an edge case where Django believes a view exists, but it doesn't. This results in it being impossible for a user to delete a view.

message: Failed to drop view data_events_base from the ManageViews table: Error dropping view a2cpsdev.data_events_base: Error accessing database: view "data_events_base" does not exist

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.