ParseDbSchema.py 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. """
  4. Created on Wed Sep 25 08:22:20 2019
  5. @author: tanya
  6. """
  7. import os
  8. import sys
  9. import abc
  10. sys.path.append(os.getcwd())
  11. class ParseDbSchema(metaclass=abc.ABCMeta):
  12. '''
  13. '''
  14. def __init__(self, schema_paths: [list, str], log_file: str = None):
  15. '''
  16. '''
  17. from cdplib.log import Log
  18. self._log = Log(name="ParseDbSchema:", log_file=log_file)
  19. if isinstance(schema_paths, str):
  20. schema_paths = [schema_paths]
  21. for schema_path in schema_paths:
  22. if not os.path.isfile(schema_path):
  23. err = "Schema not found"
  24. self._log.error(err)
  25. raise FileNotFoundError(err)
  26. @abc.abstractmethod
  27. def get_fields(self) -> list:
  28. '''
  29. '''
  30. return
  31. @abc.abstractmethod
  32. def get_datetime_fields(self) -> list:
  33. '''
  34. '''
  35. return
  36. @abc.abstractmethod
  37. def get_python_types(self) -> list:
  38. '''
  39. '''
  40. return
  41. @abc.abstractmethod
  42. def get_default_values(self) -> list:
  43. '''
  44. '''
  45. return
  46. @abc.abstractmethod
  47. def get_allowed_values(self) -> list:
  48. '''
  49. '''
  50. return