You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/06/19 22:53:06 UTC

[GitHub] [airflow] ephraimbuddy commented on a change in pull request #9266: Add CRUD endpoint for connections

ephraimbuddy commented on a change in pull request #9266:
URL: https://github.com/apache/airflow/pull/9266#discussion_r439981380



##########
File path: airflow/api_connexion/endpoints/connection_endpoint.py
##########
@@ -47,31 +55,53 @@ def get_connection(connection_id, session):
 
 
 @provide_session
-def get_connections(session):
+def get_connections(session, limit, offset=0):
     """
     Get all connection entries
     """
-    offset = request.args.get(parameters.page_offset, 0)
-    limit = min(int(request.args.get(parameters.page_limit, 100)), 100)
-
+    total_entries = session.query(func.count(Connection.id)).scalar()
     query = session.query(Connection)
-    total_entries = query.count()
-    query = query.offset(offset).limit(limit)
-
-    connections = query.all()
+    connections = query.offset(offset).limit(limit).all()
     return connection_collection_schema.dump(ConnectionCollection(connections=connections,
                                                                   total_entries=total_entries))
 
 
-def patch_connection():
+@provide_session
+def patch_connection(connection_id, session, update_mask=None):
     """
     Update a connection entry
     """
-    raise NotImplementedError("Not implemented yet.")
+    body = request.json
+    connection = session.query(Connection).filter_by(conn_id=connection_id).first()
+    if connection is None:
+        raise NotFound("Connection not found")
+    if update_mask:

Review comment:
       Also check this, https://github.com/marshmallow-code/marshmallow-sqlalchemy/issues/33#issuecomment-147008000
   
    For updatable fields, looks like we would need it in dagruns update




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org