def shows_by_artist_fields_orm() -> (Entity, Column, list[str]): """ Select shows for the specified artist """ # select Show.venue_id, Show.start_time, Venue.name, Venue.image_link # join Show and Venue on Show.venue_id == Venue.id # where Show.artist_id == entity_id return get_entity(VENUE_TABLE), get_entity( ARTIST_TABLE).orm_show_column, SHOWS_BY_KEYS
def artists_search(mode: str, form: FlaskForm, simple_search_term: str = None) -> dict: """ Perform a search on artists :param mode: one of 'basic', 'advanced' or 'all' :param form: form data :param simple_search_term: search term for basic search """ return ncsg_search(mode, form, get_entity(ARTIST_TABLE), simple_search_term=simple_search_term)
entity_search_clauses, OR_CONJUNC, AND_CONJUNC, SearchParams, entity_search_expression, SP_GENRES) from util import get_config from misc.engine import execute from misc.queries_engine import join_engine from models import ARTIST_TABLE, VENUE_TABLE, SHOWS_TABLE, get_entity, fq_column, GENRES_TABLE from .artist_engine import datetime_to_str from .controllers_misc import IGNORE_ID, model_property_list, FactoryObj, FILTER_PREVIOUS, FILTER_UPCOMING from .show_orm import SHOWS_KEYS, AvailabilitySlot # keys to extract data for db results SHOWS_DICT = {p: p for p in SHOWS_KEYS} SHOWS_PER_PAGE = get_config("SHOWS_PER_PAGE") _ARTIST_ = get_entity(ARTIST_TABLE) _VENUE_ = get_entity(VENUE_TABLE) _SHOWS_ = get_entity(SHOWS_TABLE) def show_factory_engine(obj_type: FactoryObj) -> Union[dict, str, None]: """ Get a show related object :param obj_type: object type to get :return: """ result = None if obj_type == FactoryObj.OBJECT: result = _SHOWS_.model_dict() elif obj_type == FactoryObj.CLASS: result = _SHOWS_.eng_table
from flask_wtf import FlaskForm from misc.engine import execute, execute_transaction from forms import (populate_model, AVAILABILITY_FROM_DATE_FMT, AVAILABILITY_TIME_FMT) from models import (ARTIST_TABLE, AVAILABILITY_TABLE, ARTIST_GENRES_TABLE, equal_dict, dict_disjoint, get_entity) from models import is_available, get_model_property_list, SHOWS_TABLE, fq_column from .artist_orm import IGNORE_AVAILABILITY, IGNORE_ID_DATE from .controllers_misc import add_show_summary, model_property_list, IGNORE_ID_GENRES, IGNORE_ID, FactoryObj, \ populate_genred_model from misc import (get_music_entity_engine, genre_changes_engine, exec_transaction_engine, print_exc_info, EntityResult, shows_by_artist) _ARTIST_ = get_entity(ARTIST_TABLE) _AVAILABILITY_ = get_entity(AVAILABILITY_TABLE) def artist_factory_engine(obj_type: FactoryObj) -> Union[dict, str, None]: """ Get an artist related object :param obj_type: object type to get :return: """ result = None if obj_type == FactoryObj.OBJECT: result = _ARTIST_.model_dict() elif obj_type == FactoryObj.CLASS: result = _ARTIST_.eng_table return result
from forms import (APP_DATETIME_FMT, APP_DATE_FMT, APP_TIME_FMT) from misc import EntityResult, print_exc_info from misc import get_music_entity_engine, genre_changes_engine, exec_transaction_engine from misc.engine import execute, execute_transaction from misc.queries import entity_shows_count, shows_by_venue from models import (VENUE_TABLE, SHOWS_TABLE, VENUE_GENRES_TABLE, dict_disjoint, equal_dict, ARTIST_TABLE, get_entity) from .controllers_misc import add_show_summary, model_property_list, IGNORE_ID_GENRES, IGNORE_ID, FactoryObj, \ populate_genred_model from .venue_orm import BOOKING_BY_VENUE_KEYS # keys to extract data for db results BOOKING_BY_VENUE_DICT = {p: p for p in BOOKING_BY_VENUE_KEYS} _VENUE_ = get_entity(VENUE_TABLE) def venue_factory_engine(obj_type: FactoryObj) -> Union[dict, str, None]: """ Get a venue related object :param obj_type: object type to get :return: """ result = None if obj_type == FactoryObj.OBJECT: result = _VENUE_.model_dict() elif obj_type == FactoryObj.CLASS: result = _VENUE_.eng_table return result