From: Mike Bayer Date: Sun, 3 Jul 2022 15:01:25 +0000 (-0400) Subject: dont use import * in any docs, ever X-Git-Tag: rel_1_4_40~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eef077d1a6ba711a30b9706982862d9120fa063b;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git dont use import * in any docs, ever (cherry picked from commit 9ab7b9a624cf5dfed93e0927eb4b3b62fe87e5ae) --- diff --git a/doc/build/core/metadata.rst b/doc/build/core/metadata.rst index 5c6fa2e5cb..d6a8f72dde 100644 --- a/doc/build/core/metadata.rst +++ b/doc/build/core/metadata.rst @@ -16,7 +16,7 @@ and :class:`_schema.MetaData` objects. A collection of metadata entities is stored in an object aptly named :class:`~sqlalchemy.schema.MetaData`:: - from sqlalchemy import * + from sqlalchemy import MetaData metadata_obj = MetaData() diff --git a/doc/build/core/type_basics.rst b/doc/build/core/type_basics.rst index 3ec50cc003..069214f99b 100644 --- a/doc/build/core/type_basics.rst +++ b/doc/build/core/type_basics.rst @@ -209,17 +209,17 @@ Or some PostgreSQL types:: Column('elements', postgresql.ARRAY(String)) ) -Each dialect provides the full set of typenames supported by -that backend within its `__all__` collection, so that a simple -`import *` or similar will import all supported types as -implemented for that backend:: +Each dialect provides the full set of database types supported by +that backend within its own module, so they may all be used +against the module directly without the need to differentiate between +which types are specific to that backend or not:: - from sqlalchemy.dialects.postgresql import * + from sqlalchemy.dialects import postgresql t = Table('mytable', metadata, - Column('id', INTEGER, primary_key=True), - Column('name', VARCHAR(300)), - Column('inetaddr', INET) + Column('id', postgresql.INTEGER, primary_key=True), + Column('name', postgresql.VARCHAR(300)), + Column('inetaddr', postgresql.INET) ) Where above, the INTEGER and VARCHAR types are ultimately from