def get_games_hascover(tname): query = reader.specified_input( 'hasCover', 'Enter hasCover value:').lower() in ['true', 't', 'yes', 'y', '+'] data = model.get_games_by_stadium_hascover(query) view.print_entities(f'Games with hasCover={query}', data) reader.press_enter() show_table_menu(tname)
def full_text_search_without_word(): query = view.specified_input( 'word', 'Enter your word to be absent in the document:') data = model.full_text_search_without_word(query) view.print_entities( f'Documents without word=`{query}`', data) view.press_enter() display_main_menu()
def full_text_search_by_phrase(): query = view.specified_input( 'phrase', 'Enter your phrase to be found in document:') data = model.full_text_search_by_phrase(query) view.print_entities( f'Documents with phrase=`{query}`', data) view.press_enter() display_main_menu()
def custom_query(): try: sql = reader.multiline_input('Enter your SQL query') data = model.execute(sql) view.print_entities('Custom query result', data) reader.press_enter() show_start_menu() except Exception as e: show_start_menu(err=str(e))
def search_questions_by_answer_is_valid(): query = view.specified_input( 'is_valid', 'Enter answer.is_valid value:' ).lower() in ['true', 't', 'yes', 'y', '+'] data = model.search_questions_by_answer_is_valid(query) view.print_entities( f'Questions which where answered with answer.is_valid={query}:', data) view.press_enter() display_main_menu()
def fts(tname): query = reader.specified_input('query', 'Enter your query to search in document:') contains = reader.specified_input( msg='Query word shoul be in document?').lower() in [ 'true', 't', 'yes', 'y', '+' ] data = model.fts(query, contains) view.print_entities( f'Documents corresponding to query={query} ({"" if contains else "not "}contains)', data) reader.press_enter() show_table_menu(tname)
def get_team_sporttype(tname): types = [] query = reader.specified_input( msg='Enter your queries for sportype:').lower() while query: types.append(query) query = reader.specified_input().lower() data = model.get_teams_by_sporttype(types) view.print_entities( f'Teams which played at least one of this games: {types}', data) reader.press_enter() show_table_menu(tname)
def search_users_by_question_date(): dates = view.specified_input(msg='Enter datetime range divided in format <dd/mm/yyyy hh:mm:ss>-<dd/mm/yyyy hh:mm:ss>:').split('-') data = model.search_users_by_question_date(dates) view.print_entities(f'User who wrote questions in date range={dates}', data) view.press_enter() display_main_menu()
def select(table): query = view.multiple_input(table, 'Enter requested fields:') data = model.get(table, query) view.print_entities(table, data) view.press_enter() display_secondary_menu(table)
def get(tname): query = reader.multiple_input(tname, 'Enter requested fields:', empty=True) data = model.get(tname, query) view.print_entities(tname, data) reader.press_enter() show_table_menu(tname)
def get_all(tname): data = model.get(tname) view.print_entities(tname, data) reader.press_enter() show_table_menu(tname)