jason kirtland avatar jason kirtland committed 59c7644

Docs.

Comments (0)

Files changed (1)

lib/sqlalchemy/databases/mysql.py

   Table('mytable', metadata, autoload=True,
         ForeignKeyConstraint(['other_id'], ['othertable.other_id']))
 
+When creating tables, SQLAlchemy will automatically set AUTO_INCREMENT on an
+integer primary key column::
+
+  >>> t = Table('mytable', metadata,
+  ...   Column('mytable_id', Integer, primary_key=True))
+  >>> t.create()
+  CREATE TABLE mytable (
+          id INTEGER NOT NULL AUTO_INCREMENT, 
+          PRIMARY KEY (id)
+  )
+
+You can disable this behavior by supplying ``autoincrement=False`` in addition.
+This can also be used to enable auto-increment on a secondary column in a
+multi-column key for some storage engines::
+
+  Table('mytable', metadata,
+        Column('gid', Integer, primary_key=True, autoincrement=False),
+        Column('id', Integer, primary_key=True))
+
 MySQL SQL modes are supported.  Modes that enable ``ANSI_QUOTE`` (such as
 ``ANSI``) require an engine option to modify SQLAlchemy's quoting style.
 When using an ANSI-quoting mode, supply ``use_ansiquotes=True`` when
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.