Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor metadata profile rendering logic to improve conditional checks for GeoDCAT-AP/INSPIRE (spatial datasets) profiles #117

Merged
merged 3 commits into from
Nov 14, 2024

Commits on Nov 13, 2024

  1. Refactor metadata profile rendering logic to improve conditional chec…

    …ks for GeoDCAT-AP/INSPIRE (spatial datasets) profiles
    mjanez committed Nov 13, 2024
    Configuration menu
    Copy the full SHA
    dab0ff4 View commit details
    Browse the repository at this point in the history
  2. Enhance statistics table creation and cleanup with checkfirst option …

    …and error handling
    
    2024-11-13 23:29:37,091 DEBUG [ckanext.schemingdcat.statistics.model] SchemingDCAT statistics table dropped from DB
    2024-11-13 23:29:37,108 DEBUG [ckanext.schemingdcat.statistics.model] SchemingDCAT statistics table defined in DB
    Traceback (most recent call last):
      File "/usr/lib/ckan/default/lib64/python3.9/site-packages/sqlalchemy/engine/base.py", line 1900, in _execute_context
        self.dialect.do_execute(
      File "/usr/lib/ckan/default/lib64/python3.9/site-packages/sqlalchemy/engine/default.py", line 736, in do_execute
        cursor.execute(statement, parameters)
    psycopg2.errors.DuplicateTable: relation "schemingdcat_statistics" already exists
    
    The above exception was the direct cause of the following exception:
    
    Traceback (most recent call last):
      File "/etc/ckan/default/wsgi.py", line 20, in <module>
        application = make_app(config)
      File "/usr/lib/ckan/default/src/ckan/ckan/config/middleware/__init__.py", line 27, in make_app
        load_environment(conf)
      File "/usr/lib/ckan/default/src/ckan/ckan/config/environment.py", line 69, in load_environment
        p.load_all()
      File "/usr/lib/ckan/default/src/ckan/ckan/plugins/core.py", line 222, in load_all
        load(*plugins)
      File "/usr/lib/ckan/default/src/ckan/ckan/plugins/core.py", line 253, in load
        plugins_update()
      File "/usr/lib/ckan/default/src/ckan/ckan/plugins/core.py", line 210, in plugins_update
        environment.update_config()
      File "/usr/lib/ckan/default/src/ckan/ckan/config/environment.py", line 227, in update_config
        plugin.configure(config)
      File "/usr/lib/ckan/default/src/ckanext-schemingdcat/ckanext/schemingdcat/plugin.py", line 259, in configure
        sdct_model.clean()
      File "/usr/lib/ckan/default/src/ckanext-schemingdcat/ckanext/schemingdcat/statistics/model.py", line 69, in clean
        setup()
      File "/usr/lib/ckan/default/src/ckanext-schemingdcat/ckanext/schemingdcat/statistics/model.py", line 49, in setup
        statistics_table.create()
      File "/usr/lib/ckan/default/lib64/python3.9/site-packages/sqlalchemy/sql/schema.py", line 960, in create
        bind._run_ddl_visitor(ddl.SchemaGenerator, self, checkfirst=checkfirst)
      File "/usr/lib/ckan/default/lib64/python3.9/site-packages/sqlalchemy/engine/base.py", line 3228, in _run_ddl_visitor
        conn._run_ddl_visitor(visitorcallable, element, **kwargs)
      File "/usr/lib/ckan/default/lib64/python3.9/site-packages/sqlalchemy/engine/base.py", line 2211, in _run_ddl_visitor
        visitorcallable(self.dialect, self, **kwargs).traverse_single(element)
      File "/usr/lib/ckan/default/lib64/python3.9/site-packages/sqlalchemy/sql/visitors.py", line 524, in traverse_single
        return meth(obj, **kw)
      File "/usr/lib/ckan/default/lib64/python3.9/site-packages/sqlalchemy/sql/ddl.py", line 895, in visit_table
        self.connection.execute(
      File "/usr/lib/ckan/default/lib64/python3.9/site-packages/sqlalchemy/engine/base.py", line 1380, in execute
        return meth(self, multiparams, params, _EMPTY_EXECUTION_OPTS)
      File "/usr/lib/ckan/default/lib64/python3.9/site-packages/sqlalchemy/sql/ddl.py", line 80, in _execute_on_connection
        return connection._execute_ddl(
      File "/usr/lib/ckan/default/lib64/python3.9/site-packages/sqlalchemy/engine/base.py", line 1472, in _execute_ddl
        ret = self._execute_context(
      File "/usr/lib/ckan/default/lib64/python3.9/site-packages/sqlalchemy/engine/base.py", line 1943, in _execute_context
        self._handle_dbapi_exception(
      File "/usr/lib/ckan/default/lib64/python3.9/site-packages/sqlalchemy/engine/base.py", line 2124, in _handle_dbapi_exception
        util.raise_(
      File "/usr/lib/ckan/default/lib64/python3.9/site-packages/sqlalchemy/util/compat.py", line 208, in raise_
        raise exception
      File "/usr/lib/ckan/default/lib64/python3.9/site-packages/sqlalchemy/engine/base.py", line 1900, in _execute_context
        self.dialect.do_execute(
      File "/usr/lib/ckan/default/lib64/python3.9/site-packages/sqlalchemy/engine/default.py", line 736, in do_execute
        cursor.execute(statement, parameters)
    sqlalchemy.exc.ProgrammingError: (psycopg2.errors.DuplicateTable) relation "schemingdcat_statistics" already exists
    
    [SQL:
    CREATE TABLE schemingdcat_statistics (
    	id TEXT NOT NULL,
    	stat_count INTEGER NOT NULL,
    	stat_type TEXT NOT NULL,
    	value TEXT NOT NULL,
    	icon TEXT,
    	label TEXT,
    	PRIMARY KEY (id)
    )
    
    ]
    (Background on this error at: https://sqlalche.me/e/14/f405)
    unable to load app 0 (mountpoint='') (callable not found or import error)
    mjanez committed Nov 13, 2024
    Configuration menu
    Copy the full SHA
    53c3501 View commit details
    Browse the repository at this point in the history

Commits on Nov 14, 2024

  1. Remove unnecessary static method decorator from normalize_string func…

    …tion
    
    The `'staticmethod' object is not callable' error occurs because the `@staticmethod' decorator is used outside the context of a class. The `@staticmethod' decorator only makes sense when applied to methods defined inside a class, as it makes the method static, allowing it to be called without instantiating the class.
    mjanez committed Nov 14, 2024
    Configuration menu
    Copy the full SHA
    8d7ab4b View commit details
    Browse the repository at this point in the history