--- /dev/null
+.. change::
+ :tags: change, reflection
+ :tickets: 5244
+
+ The :meth:`.Inspector.reflecttable` was renamed to
+ :meth:`.Inspector.reflect_table`.
\ No newline at end of file
conn, table_name, schema, info_cache=self.info_cache, **kw
)
- def reflecttable(
+ @util.deprecated_20(
+ ":meth:`.Inspector.reflecttable`",
+ "The :meth:`.Inspector.reflecttable` method was renamed to "
+ ":meth:`.Inspector.reflect_table`. This deprecated alias "
+ "will be removed in a future release.",
+ )
+ def reflecttable(self, *args, **kwargs):
+ "See reflect_table. This method name is deprecated"
+ return self.reflect_table(*args, **kwargs)
+
+ def reflect_table(
self,
table,
include_columns,
meta = MetaData()
user_table = Table('user', meta)
insp = Inspector.from_engine(engine)
- insp.reflecttable(user_table, None)
+ insp.reflect_table(user_table, None)
+
+ .. versionchanged:: 1.4 Renamed from ``reflecttable`` to
+ ``reflect_table``
:param table: a :class:`~sqlalchemy.schema.Table` instance.
:param include_columns: a list of string column names to include
)
insp = inspection.inspect(autoload_with)
- insp.reflecttable(
+ insp.reflect_table(
self,
include_columns,
exclude_columns,
from sqlalchemy import create_engine
from sqlalchemy import ForeignKey
from sqlalchemy import func
+from sqlalchemy import inspect
from sqlalchemy import INT
from sqlalchemy import Integer
from sqlalchemy import MetaData
table_names = testing.db.table_names()
is_true(set(table_names).issuperset(metadata.tables))
+ def test_reflecttable(self):
+ inspector = inspect(testing.db)
+ metadata = self.metadata
+ table = Table("user", metadata)
+ with testing.expect_deprecated_20(
+ r"The Inspector.reflecttable\(\) function/method is considered "
+ ):
+ res = inspector.reflecttable(table, None)
+ exp = inspector.reflect_table(table, None)
+
+ eq_(res, exp)
+
class ExecutionOptionsTest(fixtures.TestBase):
def test_branched_connection_execution_options(self):
m = MetaData()
inspector = sa.engine.reflection.Inspector
- reflecttable = inspector.reflecttable
+ reflect_table = inspector.reflect_table
def patched(self, table, *arg, **kw):
if table.name == "rt_c":
raise sa.exc.UnreflectableTableError("Can't reflect rt_c")
else:
- return reflecttable(self, table, *arg, **kw)
+ return reflect_table(self, table, *arg, **kw)
- with mock.patch.object(inspector, "reflecttable", patched):
+ with mock.patch.object(inspector, "reflect_table", patched):
with expect_warnings("Skipping table rt_c: Can't reflect rt_c"):
m.reflect(bind=testing.db)
@testing.requires.unicode_connections
def test_basic(self):
# the 'convert_unicode' should not get in the way of the
- # reflection process. reflecttable for oracle, postgresql
+ # reflection process. reflect_table for oracle, postgresql
# (others?) expect non-unicode strings in result sets/bind
# params