def _entity_config_from_table(self, table_name): """ Creates an EntityConfig object from the table name. :param table_name: Name of the database table. :type table_name: str :return: Entity configuration object. :rtype: EntityConfig """ table_display_name = display_name(table_name) model = DeclareMapping.instance().tableMapping(table_name) if model is not None: # Entity configuration entity_cfg = EntityConfiguration() entity_cfg.Title = table_display_name entity_cfg.STRModel = model entity_cfg.data_source_name = table_name """ Load filter and display columns using only those which are of numeric/varchar type """ cols = numeric_varchar_columns(table_name) search_cols = self._config_table_reader.table_searchable_columns(table_name) disp_cols = self._config_table_reader.table_columns(table_name) for c in search_cols: # Ensure it is a numeric or text type column if c in cols: entity_cfg.filterColumns[c] = display_name(c) if len(disp_cols) == 0: entity_cfg.displayColumns = entity_cfg.displayColumns else: for dc in disp_cols: if dc in cols: entity_cfg.displayColumns[dc] = display_name(dc) return entity_cfg else: return None