From 37bffd8f2b6c3b4419d6e9317bc097d52124360d Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sun, 25 Nov 2007 23:34:26 +0000 Subject: [PATCH] edits --- doc/build/content/types.txt | 56 ++++++++----------------------------- 1 file changed, 12 insertions(+), 44 deletions(-) diff --git a/doc/build/content/types.txt b/doc/build/content/types.txt index 8f9cb1f7c5..364599f0be 100644 --- a/doc/build/content/types.txt +++ b/doc/build/content/types.txt @@ -19,7 +19,7 @@ Following is a rundown of the standard types. #### String -This type is the base type for all string and character types, such as `Unicode`, `Text`, `CLOB`, etc. By default it generates a VARCHAR in DDL. It includes an argument `length`, which indicates the length in characters of the type, as well as `convert_unicode` and `assert_unicode`, which are booleans. `length` will be used as the length argument when generating DDL. If `length` is omitted, the `String` type resolves into the `Text` type. +This type is the base type for all string and character types, such as `Unicode`, `TEXT`, `CLOB`, etc. By default it generates a VARCHAR in DDL. It includes an argument `length`, which indicates the length in characters of the type, as well as `convert_unicode` and `assert_unicode`, which are booleans. `length` will be used as the length argument when generating DDL. If `length` is omitted, the `String` type resolves into the `TEXT` type. `convert_unicode=True` indicates that incoming strings, if they are Python `unicode` strings, will be encoded into a raw bytestring using the `encoding` attribute of the dialect (defaults to `utf-8`). Similarly, raw bytestrings coming back from the database will be decoded into `unicode` objects on the way back. @@ -43,6 +43,10 @@ TODO TODO +#### Interval + +TODO + #### Binary TODO @@ -51,46 +55,13 @@ TODO TODO -#### Summary of Types - {python title="package sqlalchemy.types"} - class String(TypeEngine): - def __init__(self, length=None) - - class Integer(TypeEngine) - - class SmallInteger(Integer) - - class Numeric(TypeEngine): - def __init__(self, precision=10, length=2) - - class Float(Numeric): - def __init__(self, precision=10) - - # DateTime, Date and Time types deal with datetime objects from the Python datetime module - class DateTime(TypeEngine) - - class Date(TypeEngine) - - class Time(TypeEngine) - - class Binary(TypeEngine): - def __init__(self, length=None) - - class Boolean(TypeEngine) - - # converts unicode strings to raw bytes - # as bind params, raw bytes to unicode as - # rowset values, using the unicode encoding - # setting on the engine (defaults to 'utf-8') - class Unicode(TypeDecorator): - impl = String - - # uses the pickle protocol to serialize data - # in/out of Binary columns - class PickleType(TypeDecorator): - impl = Binary +#### PickleType -More specific subclasses of these types are available, which various database engines may choose to implement specifically, allowing finer grained control over types: +TODO + +#### SQL-Specific Types {@name=sqlspecific} + +These are subclasses of the generic types and include: {python} class FLOAT(Numeric) @@ -106,9 +77,6 @@ More specific subclasses of these types are available, which various database en class BLOB(Binary) class BOOLEAN(Boolean) -When using a specific database engine, these types are adapted even further via a set of database-specific subclasses defined by the database engine. -There may eventually be more type objects that are defined for specific databases. An example of this would be Postgres' Array type. - ### Dialect Specific Types {@name=dialect} Each dialect has its own set of types, many of which are available only within that dialect. For example, MySQL has a `BigInteger` type and Postgres has an `Inet` type. To use these, import them from the module explicitly: @@ -173,4 +141,4 @@ Once you make your type, its immediately useable: Column('data', MyType(16)) ) - \ No newline at end of file + -- 2.47.2