import sqlite3


def query_from_table(db_connection, table_name, columns = '*'):
  """
  Function queries data from table.

  Arguments:
  - db_connection: sqlite3 database connection.
  - table_name: Database table name.
  - columns: A list of columns, which should be queried. By default it is set
    '*' and will query all data.
  """

  if columns != '*':
    columns = ', '.join(columns)

  cursor = db_connection.cursor()
  query = []
  try:
    query_str = 'SELECT ' + columns + ' FROM ' + table_name
    cursor.execute(query_str)
    query = cursor.fetchall()
  except sqlite3.OperationalError:
    print(sqlite3.OperationalError, 'Query: statement failed with Operational error')

  return query