@@ -94,7 +94,7 @@ def list_tables(jwt_payload, schema_name):
9494 table_name (string): Table name under the given schema, must be in camel case
9595
9696 Returns:
97- ( tuples)
97+ list<tuples_as_dicts>: a list of tuples in dict form
9898 """
9999 @staticmethod
100100 def fetch_tuples (jwt_payload , schema_name , table_name ):
@@ -103,6 +103,24 @@ def fetch_tuples(jwt_payload, schema_name, table_name):
103103 schema_virtual_module = dj .create_virtual_module (schema_name , schema_name )
104104 return getattr (schema_virtual_module , table_name ).fetch (as_dict = True )
105105
106+ """
107+ Get the table definition
108+
109+ Parameters:
110+ jwt_payload (dict): Dictionary containing databaseAddress, username and password strings
111+ schema_name (string): Schema name where to find the table under
112+ table_name (string): Table name under the given schema, must be in camel case
113+
114+ Returns:
115+ string: definition of the table
116+ """
117+ @staticmethod
118+ def get_table_definition (jwt_payload , schema_name , table_name ):
119+ DJConnector .set_datajoint_config (jwt_payload )
120+
121+ schema_virtual_module = dj .create_virtual_module (schema_name , schema_name )
122+ return getattr (schema_virtual_module , table_name ).describe ()
123+
106124 """
107125 Method to set credentials for database
108126
@@ -119,6 +137,7 @@ def set_datajoint_config(jwt_payload):
119137 dj .config ['database.password' ] = jwt_payload ['password' ]
120138
121139 dj .conn (reset = True )
140+
122141 """
123142 Helper method for converting snake to camel case
124143
0 commit comments