Skip to content
Snippets Groups Projects
Unverified Commit 4de6ddad authored by Martin Weise's avatar Martin Weise
Browse files

Added analyse API and fixed the flasgger oas3

parent 867d5f9e
No related branches found
No related tags found
2 merge requests!81New stable release,!80Multiple features connected with user management and ownership of databases
This commit is part of merge request !81. Comments created here will be created in the context of that merge request.
Showing
with 1299 additions and 0 deletions
# coding: utf-8
# flake8: noqa
"""
Database Repository Analyse Service API
Service that manages the analysis # noqa: E501
OpenAPI spec version: 1.1.0-alpha
Contact: andreas.rauber@tuwien.ac.at
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
# import apis into sdk package
from api_analyse.api.analyse_endpoint_api import AnalyseEndpointApi
from api_analyse.api.mdb_endpoint_api import MdbEndpointApi
# import ApiClient
from api_analyse.api_client import ApiClient
from api_analyse.configuration import Configuration
# import models into sdk package
from api_analyse.models.analyse_determinepk_body import AnalyseDeterminepkBody
from api_analyse.models.data_type_dto import DataTypeDto
from api_analyse.models.determine_data_type_request_dto import DetermineDataTypeRequestDto
from api_analyse.models.determine_data_type_response_dto import DetermineDataTypeResponseDto
from api_analyse.models.determine_primary_key_dto import DeterminePrimaryKeyDto
from api_analyse.models.error_dto import ErrorDto
from api_analyse.models.update_column_dto import UpdateColumnDto
File added
File added
File added
File added
from __future__ import absolute_import
# flake8: noqa
# import apis into api package
from api_analyse.api.analyse_endpoint_api import AnalyseEndpointApi
from api_analyse.api.mdb_endpoint_api import MdbEndpointApi
File added
File added
File added
# coding: utf-8
"""
Database Repository Analyse Service API
Service that manages the analysis # noqa: E501
OpenAPI spec version: 1.1.0-alpha
Contact: andreas.rauber@tuwien.ac.at
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import re # noqa: F401
# python 2 and python 3 compatibility library
import six
from api_analyse.api_client import ApiClient
class AnalyseEndpointApi(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def api_analyse_determinedt_post(self, body, **kwargs): # noqa: E501
"""Determine datatypes # noqa: E501
This is a simple API which returns the datatypes of a (path) csv file # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.api_analyse_determinedt_post(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param DetermineDataTypeRequestDto body: (required)
:return: list[DetermineDataTypeResponseDto]
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.api_analyse_determinedt_post_with_http_info(body, **kwargs) # noqa: E501
else:
(data) = self.api_analyse_determinedt_post_with_http_info(body, **kwargs) # noqa: E501
return data
def api_analyse_determinedt_post_with_http_info(self, body, **kwargs): # noqa: E501
"""Determine datatypes # noqa: E501
This is a simple API which returns the datatypes of a (path) csv file # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.api_analyse_determinedt_post_with_http_info(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param DetermineDataTypeRequestDto body: (required)
:return: list[DetermineDataTypeResponseDto]
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['body'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method api_analyse_determinedt_post" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if ('body' not in params or
params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `api_analyse_determinedt_post`") # noqa: E501
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['*/*']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['*/*']) # noqa: E501
# Authentication setting
auth_settings = [] # noqa: E501
return self.api_client.call_api(
'/api/analyse/determinedt', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='list[DetermineDataTypeResponseDto]', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def api_analyse_determinepk_post(self, body, **kwargs): # noqa: E501
"""Determine primary keys # noqa: E501
This is a simple API which returns the primary keys + ranking of a (path) csv file # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.api_analyse_determinepk_post(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param AnalyseDeterminepkBody body: (required)
:return: DeterminePrimaryKeyDto
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.api_analyse_determinepk_post_with_http_info(body, **kwargs) # noqa: E501
else:
(data) = self.api_analyse_determinepk_post_with_http_info(body, **kwargs) # noqa: E501
return data
def api_analyse_determinepk_post_with_http_info(self, body, **kwargs): # noqa: E501
"""Determine primary keys # noqa: E501
This is a simple API which returns the primary keys + ranking of a (path) csv file # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.api_analyse_determinepk_post_with_http_info(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param AnalyseDeterminepkBody body: (required)
:return: DeterminePrimaryKeyDto
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['body'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method api_analyse_determinepk_post" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if ('body' not in params or
params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `api_analyse_determinepk_post`") # noqa: E501
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['*/*']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = [] # noqa: E501
return self.api_client.call_api(
'/api/analyse/determinepk', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='DeterminePrimaryKeyDto', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
# coding: utf-8
"""
Database Repository Analyse Service API
Service that manages the analysis # noqa: E501
OpenAPI spec version: 1.1.0-alpha
Contact: andreas.rauber@tuwien.ac.at
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import re # noqa: F401
# python 2 and python 3 compatibility library
import six
from api_analyse.api_client import ApiClient
class MdbEndpointApi(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def api_analyse_update_mdb_col_post(self, body, **kwargs): # noqa: E501
"""Update entity mdb_columns from metadatabase # noqa: E501
Updates entity mdb_columns and mdb_columns_num, mdb_columns_nom and mdb_columns_cat in metadatabase # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.api_analyse_update_mdb_col_post(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param UpdateColumnDto body: Updates entity mdb_columns attributes (datatype, ordinal_position, is_nullable) and automatically updates mdb_columns_nom (attribute max_length), mdb_columns_num (min, max, mean, sd, histogram) and mdb_columns_cat (num_cat, cat_array). The attribute 'histogram' describes a equi-width histogram with a fix number of 10 buckets. The last value in this numeric array is the width of one bucket. The attribute cat_array contains an array with the names of the categories. (required)
:return: UpdateColumnDto
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.api_analyse_update_mdb_col_post_with_http_info(body, **kwargs) # noqa: E501
else:
(data) = self.api_analyse_update_mdb_col_post_with_http_info(body, **kwargs) # noqa: E501
return data
def api_analyse_update_mdb_col_post_with_http_info(self, body, **kwargs): # noqa: E501
"""Update entity mdb_columns from metadatabase # noqa: E501
Updates entity mdb_columns and mdb_columns_num, mdb_columns_nom and mdb_columns_cat in metadatabase # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.api_analyse_update_mdb_col_post_with_http_info(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param UpdateColumnDto body: Updates entity mdb_columns attributes (datatype, ordinal_position, is_nullable) and automatically updates mdb_columns_nom (attribute max_length), mdb_columns_num (min, max, mean, sd, histogram) and mdb_columns_cat (num_cat, cat_array). The attribute 'histogram' describes a equi-width histogram with a fix number of 10 buckets. The last value in this numeric array is the width of one bucket. The attribute cat_array contains an array with the names of the categories. (required)
:return: UpdateColumnDto
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['body'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method api_analyse_update_mdb_col_post" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if ('body' not in params or
params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `api_analyse_update_mdb_col_post`") # noqa: E501
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['*/*']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['*/*']) # noqa: E501
# Authentication setting
auth_settings = [] # noqa: E501
return self.api_client.call_api(
'/api/analyse/update_mdb_col', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='UpdateColumnDto', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
This diff is collapsed.
# coding: utf-8
"""
Database Repository Analyse Service API
Service that manages the analysis # noqa: E501
OpenAPI spec version: 1.1.0-alpha
Contact: andreas.rauber@tuwien.ac.at
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import copy
import logging
import multiprocessing
import sys
import urllib3
import six
from six.moves import http_client as httplib
class TypeWithDefault(type):
def __init__(cls, name, bases, dct):
super(TypeWithDefault, cls).__init__(name, bases, dct)
cls._default = None
def __call__(cls):
if cls._default is None:
cls._default = type.__call__(cls)
return copy.copy(cls._default)
def set_default(cls, default):
cls._default = copy.copy(default)
class Configuration(six.with_metaclass(TypeWithDefault, object)):
"""NOTE: This class is auto generated by the swagger code generator program.
Ref: https://github.com/swagger-api/swagger-codegen
Do not edit the class manually.
"""
def __init__(self):
"""Constructor"""
# Default Base url
self.host = "https://virtserver.swaggerhub.com/mweise/dbrepo-debug/1.1.0-alpha"
# Temp file folder for downloading files
self.temp_folder_path = None
# Authentication Settings
# dict to store API key(s)
self.api_key = {}
# dict to store API prefix (e.g. Bearer)
self.api_key_prefix = {}
# function to refresh API key if expired
self.refresh_api_key_hook = None
# Username for HTTP basic authentication
self.username = ""
# Password for HTTP basic authentication
self.password = ""
# Logging Settings
self.logger = {}
self.logger["package_logger"] = logging.getLogger("api_analyse")
self.logger["urllib3_logger"] = logging.getLogger("urllib3")
# Log format
self.logger_format = '%(asctime)s %(levelname)s %(message)s'
# Log stream handler
self.logger_stream_handler = None
# Log file handler
self.logger_file_handler = None
# Debug file location
self.logger_file = None
# Debug switch
self.debug = False
# SSL/TLS verification
# Set this to false to skip verifying SSL certificate when calling API
# from https server.
self.verify_ssl = True
# Set this to customize the certificate file to verify the peer.
self.ssl_ca_cert = None
# client certificate file
self.cert_file = None
# client key file
self.key_file = None
# Set this to True/False to enable/disable SSL hostname verification.
self.assert_hostname = None
# urllib3 connection pool's maximum number of connections saved
# per pool. urllib3 uses 1 connection as default value, but this is
# not the best value when you are making a lot of possibly parallel
# requests to the same host, which is often the case here.
# cpu_count * 5 is used as default value to increase performance.
self.connection_pool_maxsize = multiprocessing.cpu_count() * 5
# Proxy URL
self.proxy = None
# Safe chars for path_param
self.safe_chars_for_path_param = ''
@property
def logger_file(self):
"""The logger file.
If the logger_file is None, then add stream handler and remove file
handler. Otherwise, add file handler and remove stream handler.
:param value: The logger_file path.
:type: str
"""
return self.__logger_file
@logger_file.setter
def logger_file(self, value):
"""The logger file.
If the logger_file is None, then add stream handler and remove file
handler. Otherwise, add file handler and remove stream handler.
:param value: The logger_file path.
:type: str
"""
self.__logger_file = value
if self.__logger_file:
# If set logging file,
# then add file handler and remove stream handler.
self.logger_file_handler = logging.FileHandler(self.__logger_file)
self.logger_file_handler.setFormatter(self.logger_formatter)
for _, logger in six.iteritems(self.logger):
logger.addHandler(self.logger_file_handler)
if self.logger_stream_handler:
logger.removeHandler(self.logger_stream_handler)
else:
# If not set logging file,
# then add stream handler and remove file handler.
self.logger_stream_handler = logging.StreamHandler()
self.logger_stream_handler.setFormatter(self.logger_formatter)
for _, logger in six.iteritems(self.logger):
logger.addHandler(self.logger_stream_handler)
if self.logger_file_handler:
logger.removeHandler(self.logger_file_handler)
@property
def debug(self):
"""Debug status
:param value: The debug status, True or False.
:type: bool
"""
return self.__debug
@debug.setter
def debug(self, value):
"""Debug status
:param value: The debug status, True or False.
:type: bool
"""
self.__debug = value
if self.__debug:
# if debug status is True, turn on debug logging
for _, logger in six.iteritems(self.logger):
logger.setLevel(logging.DEBUG)
# turn on httplib debug
httplib.HTTPConnection.debuglevel = 1
else:
# if debug status is False, turn off debug logging,
# setting log level to default `logging.WARNING`
for _, logger in six.iteritems(self.logger):
logger.setLevel(logging.WARNING)
# turn off httplib debug
httplib.HTTPConnection.debuglevel = 0
@property
def logger_format(self):
"""The logger format.
The logger_formatter will be updated when sets logger_format.
:param value: The format string.
:type: str
"""
return self.__logger_format
@logger_format.setter
def logger_format(self, value):
"""The logger format.
The logger_formatter will be updated when sets logger_format.
:param value: The format string.
:type: str
"""
self.__logger_format = value
self.logger_formatter = logging.Formatter(self.__logger_format)
def get_api_key_with_prefix(self, identifier):
"""Gets API key (with prefix if set).
:param identifier: The identifier of apiKey.
:return: The token for api key authentication.
"""
if self.refresh_api_key_hook:
self.refresh_api_key_hook(self)
key = self.api_key.get(identifier)
if key:
prefix = self.api_key_prefix.get(identifier)
if prefix:
return "%s %s" % (prefix, key)
else:
return key
def get_basic_auth_token(self):
"""Gets HTTP basic authentication header (string).
:return: The token for basic HTTP authentication.
"""
return urllib3.util.make_headers(
basic_auth=self.username + ':' + self.password
).get('authorization')
def auth_settings(self):
"""Gets Auth Settings dict for api client.
:return: The Auth Settings information dict.
"""
return {
}
def to_debug_report(self):
"""Gets the essential information for debugging.
:return: The report for debugging.
"""
return "Python SDK Debug Report:\n"\
"OS: {env}\n"\
"Python Version: {pyversion}\n"\
"Version of the API: 1.1.0-alpha\n"\
"SDK Package Version: 1.0.0".\
format(env=sys.platform, pyversion=sys.version)
# coding: utf-8
# flake8: noqa
"""
Database Repository Analyse Service API
Service that manages the analysis # noqa: E501
OpenAPI spec version: 1.1.0-alpha
Contact: andreas.rauber@tuwien.ac.at
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
# import models into model package
from api_analyse.models.analyse_determinepk_body import AnalyseDeterminepkBody
from api_analyse.models.data_type_dto import DataTypeDto
from api_analyse.models.determine_data_type_request_dto import DetermineDataTypeRequestDto
from api_analyse.models.determine_data_type_response_dto import DetermineDataTypeResponseDto
from api_analyse.models.determine_primary_key_dto import DeterminePrimaryKeyDto
from api_analyse.models.error_dto import ErrorDto
from api_analyse.models.update_column_dto import UpdateColumnDto
File added
File added
File added
File added
File added
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment