<s> from __future__ import absolute_import , division , print_function <EOL> import sqlalchemy as sa <EOL> from . compatibility import basestring <EOL> from . dispatch import dispatch <EOL> __all__ = ( ) <EOL> @ dispatch ( sa . Table , basestring ) <EOL> def create_index ( s , column , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> return create_index ( s , ( column , ) , ** kwargs ) <EOL> @ dispatch ( sa . Table , ( list , tuple ) ) <EOL> def create_index ( s , <EOL> columns , <EOL> name = None , <EOL> unique = False , <EOL> ignore_existing = False , <EOL> concurrently = False ) : <EOL> """<STR_LIT>""" <EOL> if name is None : <EOL> raise ValueError ( '<STR_LIT>' ) <EOL> try : <EOL> sa . Index ( <EOL> name , <EOL> * ( s . c [ c ] for c in columns ) , <EOL> unique = unique , <EOL> ** { '<STR_LIT>' : concurrently } if concurrently else { } <EOL> ) . create ( s . bind ) <EOL> except ( sa . exc . ProgrammingError , sa . exc . OperationalError ) : <EOL> if not ignore_existing : <EOL> raise </s>
