A variable length Unicode string type. The :class:`.Unicode` type is a :class:`.String` subclass that assumes input and output strings that may contain non-ASCII characters, and for some backends implies an underlying column type that is explicitly supporting of non-ASCII data, such
| 305 | |
| 306 | |
| 307 | class Unicode(String): |
| 308 | """A variable length Unicode string type. |
| 309 | |
| 310 | The :class:`.Unicode` type is a :class:`.String` subclass that assumes |
| 311 | input and output strings that may contain non-ASCII characters, and for |
| 312 | some backends implies an underlying column type that is explicitly |
| 313 | supporting of non-ASCII data, such as ``NVARCHAR`` on Oracle Database and |
| 314 | SQL Server. This will impact the output of ``CREATE TABLE`` statements and |
| 315 | ``CAST`` functions at the dialect level. |
| 316 | |
| 317 | The character encoding used by the :class:`.Unicode` type that is used to |
| 318 | transmit and receive data to the database is usually determined by the |
| 319 | DBAPI itself. All modern DBAPIs accommodate non-ASCII strings but may have |
| 320 | different methods of managing database encodings; if necessary, this |
| 321 | encoding should be configured as detailed in the notes for the target DBAPI |
| 322 | in the :ref:`dialect_toplevel` section. |
| 323 | |
| 324 | In modern SQLAlchemy, use of the :class:`.Unicode` datatype does not |
| 325 | imply any encoding/decoding behavior within SQLAlchemy itself. In Python |
| 326 | 3, all string objects are inherently Unicode capable, and SQLAlchemy |
| 327 | does not produce bytestring objects nor does it accommodate a DBAPI that |
| 328 | does not return Python Unicode objects in result sets for string values. |
| 329 | |
| 330 | .. warning:: Some database backends, particularly SQL Server with pyodbc, |
| 331 | are known to have undesirable behaviors regarding data that is noted |
| 332 | as being of ``NVARCHAR`` type as opposed to ``VARCHAR``, including |
| 333 | datatype mismatch errors and non-use of indexes. See the section |
| 334 | on :meth:`.DialectEvents.do_setinputsizes` for background on working |
| 335 | around unicode character issues for backends like SQL Server with |
| 336 | pyodbc as well as cx_Oracle. |
| 337 | |
| 338 | .. seealso:: |
| 339 | |
| 340 | :class:`.UnicodeText` - unlengthed textual counterpart |
| 341 | to :class:`.Unicode`. |
| 342 | |
| 343 | :meth:`.DialectEvents.do_setinputsizes` |
| 344 | |
| 345 | """ |
| 346 | |
| 347 | __visit_name__ = "unicode" |
| 348 | |
| 349 | |
| 350 | class UnicodeText(Text): |
no outgoing calls