summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql
diff options
context:
space:
mode:
authormike bayer <mike_mp@zzzcomputing.com>2020-05-15 17:11:20 +0000
committerGerrit Code Review <gerrit@bbpush.zzzcomputing.com>2020-05-15 17:11:20 +0000
commitd4182d4da96c622e262f1bb6ea9a077cde090b7e (patch)
tree3cfa3b94e50dea98466cd9eb522d66b06045b307 /lib/sqlalchemy/sql
parent393fa8417d5bcf75f3ea48e5cbb0198a3bd7a5a8 (diff)
parent187a3a27cf8303ba332e011a482bd3b21cd3c01c (diff)
downloadsqlalchemy-d4182d4da96c622e262f1bb6ea9a077cde090b7e.tar.gz
Merge "Add 'schema' parameter to table"
Diffstat (limited to 'lib/sqlalchemy/sql')
-rw-r--r--lib/sqlalchemy/sql/selectable.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/sqlalchemy/sql/selectable.py b/lib/sqlalchemy/sql/selectable.py
index c8df637ba..27b9425ec 100644
--- a/lib/sqlalchemy/sql/selectable.py
+++ b/lib/sqlalchemy/sql/selectable.py
@@ -1878,9 +1878,9 @@ class FromGrouping(GroupedElement, FromClause):
class TableClause(Immutable, FromClause):
"""Represents a minimal "table" construct.
- This is a lightweight table object that has only a name and a
+ This is a lightweight table object that has only a name, a
collection of columns, which are typically produced
- by the :func:`_expression.column` function::
+ by the :func:`_expression.column` function, and a schema::
from sqlalchemy import table, column
@@ -1925,7 +1925,7 @@ class TableClause(Immutable, FromClause):
_autoincrement_column = None
"""No PK or default support so no autoincrement column."""
- def __init__(self, name, *columns):
+ def __init__(self, name, *columns, **kw):
"""Produce a new :class:`_expression.TableClause`.
The object returned is an instance of :class:`_expression.TableClause`
@@ -1938,10 +1938,15 @@ class TableClause(Immutable, FromClause):
be imported from the plain ``sqlalchemy`` namespace like any
other SQL element.
+
:param name: Name of the table.
:param columns: A collection of :func:`_expression.column` constructs.
+ :param schema: The schema name for this table.
+
+ .. versionadded:: 1.3.17 :func:`_expression.table` can now
+ accept a ``schema`` argument.
"""
super(TableClause, self).__init__()
@@ -1952,6 +1957,12 @@ class TableClause(Immutable, FromClause):
for c in columns:
self.append_column(c)
+ schema = kw.pop("schema", None)
+ if schema is not None:
+ self.schema = schema
+ if kw:
+ raise exc.ArgumentError("Unsupported argument(s): %s" % list(kw))
+
def _refresh_for_new_column(self, column):
pass