'Given a Table object, load its internal constructs based on
introspection.
This is the underlying method used by most dialects to produce
table reflection.  Direct usage is like::
from sqlalchemy import create_engine, MetaData, Table
from sqlalchemy.engine import reflection
engine = create_engine(\'...\')
meta = MetaData()
user_table = Table(\'user\', meta)
insp = Inspector.from_engine(engine)
insp.reflecttable(user_table, None)
:param table: a :class:`~sqlalchemy.schema.Table` instance.
:param include_columns: a list of string column names to include
in the reflection process.  If ``None``, all columns are reflected.'

def reflecttable(self, table, include_columns, exclude_columns=()):

    dialect = self.bind.dialect
    schema = table.schema
    table_name = table.name
    reflection_options = dict(((k, table.dialect_kwargs.get(k)) for k in dialect.reflection_options if (k in table.dialect_kwargs)))
    tbl_opts = self.get_table_options(table_name, schema, **table.dialect_kwargs)
    if tbl_opts:
        table._validate_dialect_kwargs(tbl_opts)
    if util.py2k:
        if isinstance(schema, str):
            schema = schema.decode(dialect.encoding)
        if isinstance(table_name, str):
            table_name = table_name.decode(dialect.encoding)
    found_table = False
    cols_by_orig_name = {}
    for col_d in self.get_columns(table_name, schema, **table.dialect_kwargs):
        found_table = True
        orig_name = col_d['name']
        table.dispatch.column_reflect(self, table, col_d)
        name = col_d['name']
        if (include_columns and (name not in include_columns)):
            continue
        if (exclude_columns and (name in exclude_columns)):
            continue
        coltype = col_d['type']
        col_kw = dict(((k, col_d[k]) for k in ['nullable', 'autoincrement', 'quote', 'info', 'key'] if (k in col_d)))
        colargs = []
        if (col_d.get('default') is not None):
            colargs.append(sa_schema.DefaultClause(sql.text(col_d['default']), _reflected=True))
        if ('sequence' in col_d):
            seq = col_d['sequence']
            sequence = sa_schema.Sequence(seq['name'], 1, 1)
            if ('start' in seq):
                sequence.start = seq['start']
            if ('increment' in seq):
                sequence.increment = seq['increment']
            colargs.append(sequence)
        cols_by_orig_name[orig_name] = col = sa_schema.Column(name, coltype, *colargs, **col_kw)
        if (col.key in table.primary_key):
            col.primary_key = True
        table.append_column(col)
    if (not found_table):
        raise exc.NoSuchTableError(table.name)
    pk_cons = self.get_pk_constraint(table_name, schema, **table.dialect_kwargs)
    if pk_cons:
        pk_cols = [cols_by_orig_name[pk] for pk in pk_cons['constrained_columns'] if ((pk in cols_by_orig_name) and (pk not in exclude_columns))]
        table.primary_key.name = pk_cons.get('name')
        table.primary_key._reload(pk_cols)
    fkeys = self.get_foreign_keys(table_name, schema, **table.dialect_kwargs)
    for fkey_d in fkeys:
        conname = fkey_d['name']
        constrained_columns = [(cols_by_orig_name[c].key if (c in cols_by_orig_name) else c) for c in fkey_d['constrained_columns']]
        if (exclude_columns and set(constrained_columns).intersection(exclude_columns)):
            continue
        referred_schema = fkey_d['referred_schema']
        referred_table = fkey_d['referred_table']
        referred_columns = fkey_d['referred_columns']
        refspec = []
        if (referred_schema is not None):
            sa_schema.Table(referred_table, table.metadata, autoload=True, schema=referred_schema, autoload_with=self.bind, **reflection_options)
            for column in referred_columns:
                refspec.append('.'.join([referred_schema, referred_table, column]))
        else:
            sa_schema.Table(referred_table, table.metadata, autoload=True, autoload_with=self.bind, **reflection_options)
            for column in referred_columns:
                refspec.append('.'.join([referred_table, column]))
        if ('options' in fkey_d):
            options = fkey_d['options']
        else:
            options = {}
        table.append_constraint(sa_schema.ForeignKeyConstraint(constrained_columns, refspec, conname, link_to_name=True, **options))
    indexes = self.get_indexes(table_name, schema)
    for index_d in indexes:
        name = index_d['name']
        columns = index_d['column_names']
        unique = index_d['unique']
        flavor = index_d.get('type', 'unknown    type')
        if (include_columns and (not set(columns).issubset(include_columns))):
            util.warn(('Omitting    %s    KEY    for    (%s),    key    covers    omitted    columns.' % (flavor, ',    '.join(columns))))
            continue
        sa_schema.Index(name, *[(cols_by_orig_name[c] if (c in cols_by_orig_name) else table.c[c]) for c in columns], **dict(unique=unique))
