Skip to content
Snippets Groups Projects
Commit fd36183a authored by schulmax's avatar schulmax
Browse files

[TASK] Adds can_execute methods for loaders

Before this commit every loader just used the
can_execute of the AbstractLoader.
parent c4275e90
No related branches found
No related tags found
No related merge requests found
...@@ -132,6 +132,9 @@ class CsvLoader(AbstractLoader): ...@@ -132,6 +132,9 @@ class CsvLoader(AbstractLoader):
self.dialect = dialect self.dialect = dialect
self._resolve_dialect() self._resolve_dialect()
def can_execute(self, connector):
'''Defines which connector can be handled by this extractor.'''
return isinstance(connector, FileConnector)
def _update(self, data = []): def _update(self, data = []):
'''This loader can not update records. Therefore only empty data is allowed''' '''This loader can not update records. Therefore only empty data is allowed'''
...@@ -201,6 +204,10 @@ class SqlAlchemyLoader(AbstractLoader): ...@@ -201,6 +204,10 @@ class SqlAlchemyLoader(AbstractLoader):
self.table_name = table_name self.table_name = table_name
'''The name of the table where the records will be load.''' '''The name of the table where the records will be load.'''
def can_execute(self, connector):
'''Defines which connector can be handled by this extractor.'''
return isinstance(connector, SqlAlchemyConnector)
def _execute(self, result): def _execute(self, result):
'''Executes the loading of data. Distinguishes between update, insert and delete''' '''Executes the loading of data. Distinguishes between update, insert and delete'''
self.table = Table(self.table_name, self.table = Table(self.table_name,
...@@ -299,6 +306,10 @@ class LdapLoader(AbstractLoader): ...@@ -299,6 +306,10 @@ class LdapLoader(AbstractLoader):
self.objectClass = objectClass self.objectClass = objectClass
'''The objectClass of new inserted records.''' '''The objectClass of new inserted records.'''
def can_execute(self, connector):
'''Defines which connector can be handled by this extractor.'''
return isinstance(connector, LdapConnector)
def _execute(self, result): def _execute(self, result):
'''Executes the loading of data. Distinguishes between update, insert and delete.''' '''Executes the loading of data. Distinguishes between update, insert and delete.'''
logging.debug('Loads data: ' + self.__class__.__name__) logging.debug('Loads data: ' + self.__class__.__name__)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment