def suggest_type(full_text, text_before_cursor):
word_before_cursor = last_word(text_before_cursor,<EOL>include='<STR_LIT>')<EOL>identifier = None<EOL>try:<EOL><INDENT>if word_before_cursor:<EOL><INDENT>if word_before_cursor.endswith(<EOL>'<STR_LIT:(>') or word_before_cursor.startswith('<STR_LIT:\\>'):<EOL><INDENT>parsed = sqlparse.parse(text_before_cursor)<EOL><DEDENT>else:<EOL><INDENT>parsed = sqlparse.parse(<EOL>text_before_cursor[:-len(word_before_cursor)])<EOL>p = sqlparse.parse(word_before_cursor)[<NUM_LIT:0>]<EOL>if p.tokens and isinstance(p.tokens[<NUM_LIT:0>], Identifier):<EOL><INDENT>identifier = p.tokens[<NUM_LIT:0>]<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>parsed = sqlparse.parse(text_before_cursor)<EOL><DEDENT><DEDENT>except (TypeError, AttributeError):<EOL><INDENT>return (Keyword(),)<EOL><DEDENT>if len(parsed) > <NUM_LIT:1>:<EOL><INDENT>current_pos = len(text_before_cursor)<EOL>stmt_start, stmt_end = <NUM_LIT:0>, <NUM_LIT:0><EOL>for statement in parsed:<EOL><INDENT>stmt_len = len(text_type(statement))<EOL>stmt_start, stmt_end = stmt_end, stmt_end + stmt_len<EOL>if stmt_end >= current_pos:<EOL><INDENT>text_before_cursor = full_text[stmt_start:current_pos]<EOL>full_text = full_text[stmt_start:]<EOL>break<EOL><DEDENT><DEDENT><DEDENT>elif parsed:<EOL><INDENT>statement = parsed[<NUM_LIT:0>]<EOL><DEDENT>else:<EOL><INDENT>statement = None<EOL><DEDENT>if statement:<EOL><INDENT>tok1 = statement.token_first()<EOL>if tok1 and tok1.value in ['<STR_LIT:\\>', '<STR_LIT:source>']:<EOL><INDENT>return suggest_special(text_before_cursor)<EOL><DEDENT><DEDENT>last_token = statement and statement.token_prev(len(statement.tokens))[<NUM_LIT:1>] or '<STR_LIT>'<EOL>return suggest_based_on_last_token(last_token, text_before_cursor,<EOL>full_text, identifier)<EOL>
Takes the full_text that is typed so far and also the text before the
    cursor to suggest completion type and scope.
    Returns a tuple with a type of entity ('table', 'column' etc) and a scope.
    A scope for a column category will be a list of tables.