diff options
Diffstat (limited to 'lib/sqlalchemy/dialects/sqlite/base.py')
| -rw-r--r-- | lib/sqlalchemy/dialects/sqlite/base.py | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/lib/sqlalchemy/dialects/sqlite/base.py b/lib/sqlalchemy/dialects/sqlite/base.py index d6239f094..76193ff91 100644 --- a/lib/sqlalchemy/dialects/sqlite/base.py +++ b/lib/sqlalchemy/dialects/sqlite/base.py @@ -5,7 +5,7 @@ # This module is part of SQLAlchemy and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php -""" +r""" .. dialect:: sqlite :name: SQLite @@ -390,7 +390,7 @@ The bug, entirely outside of SQLAlchemy, can be illustrated thusly:: union select x.a, x.b from x where a=2 ''') - assert [c[0] for c in cursor.description] == ['a', 'b'], \\ + assert [c[0] for c in cursor.description] == ['a', 'b'], \ [c[0] for c in cursor.description] The second assertion fails:: @@ -527,7 +527,7 @@ class _DateTimeMixin(object): class DATETIME(_DateTimeMixin, sqltypes.DateTime): - """Represent a Python datetime object in SQLite using a string. + r"""Represent a Python datetime object in SQLite using a string. The default string storage format is:: @@ -621,7 +621,7 @@ class DATETIME(_DateTimeMixin, sqltypes.DateTime): class DATE(_DateTimeMixin, sqltypes.Date): - """Represent a Python date object in SQLite using a string. + r"""Represent a Python date object in SQLite using a string. The default string storage format is:: @@ -682,7 +682,7 @@ class DATE(_DateTimeMixin, sqltypes.Date): class TIME(_DateTimeMixin, sqltypes.Time): - """Represent a Python time object in SQLite using a string. + r"""Represent a Python time object in SQLite using a string. The default string storage format is:: @@ -1308,7 +1308,7 @@ class SQLiteDialect(default.DefaultDialect): constraint_name = None table_data = self._get_table_sql(connection, table_name, schema=schema) if table_data: - PK_PATTERN = 'CONSTRAINT (\w+) PRIMARY KEY' + PK_PATTERN = r'CONSTRAINT (\w+) PRIMARY KEY' result = re.search(PK_PATTERN, table_data, re.I) constraint_name = result.group(1) if result else None @@ -1381,11 +1381,11 @@ class SQLiteDialect(default.DefaultDialect): def parse_fks(): FK_PATTERN = ( - '(?:CONSTRAINT (\w+) +)?' - 'FOREIGN KEY *\( *(.+?) *\) +' - 'REFERENCES +(?:(?:"(.+?)")|([a-z0-9_]+)) *\((.+?)\) *' - '((?:ON (?:DELETE|UPDATE) ' - '(?:SET NULL|SET DEFAULT|CASCADE|RESTRICT|NO ACTION) *)*)' + r'(?:CONSTRAINT (\w+) +)?' + r'FOREIGN KEY *\( *(.+?) *\) +' + r'REFERENCES +(?:(?:"(.+?)")|([a-z0-9_]+)) *\((.+?)\) *' + r'((?:ON (?:DELETE|UPDATE) ' + r'(?:SET NULL|SET DEFAULT|CASCADE|RESTRICT|NO ACTION) *)*)' ) for match in re.finditer(FK_PATTERN, table_data, re.I): ( @@ -1462,10 +1462,10 @@ class SQLiteDialect(default.DefaultDialect): unique_constraints = [] def parse_uqs(): - UNIQUE_PATTERN = '(?:CONSTRAINT "?(.+?)"? +)?UNIQUE *\((.+?)\)' + UNIQUE_PATTERN = r'(?:CONSTRAINT "?(.+?)"? +)?UNIQUE *\((.+?)\)' INLINE_UNIQUE_PATTERN = ( - '(?:(".+?")|([a-z0-9]+)) ' - '+[a-z0-9_ ]+? +UNIQUE') + r'(?:(".+?")|([a-z0-9]+)) ' + r'+[a-z0-9_ ]+? +UNIQUE') for match in re.finditer(UNIQUE_PATTERN, table_data, re.I): name, cols = match.group(1, 2) @@ -1501,8 +1501,8 @@ class SQLiteDialect(default.DefaultDialect): return [] CHECK_PATTERN = ( - '(?:CONSTRAINT (\w+) +)?' - 'CHECK *\( *(.+) *\),? *' + r'(?:CONSTRAINT (\w+) +)?' + r'CHECK *\( *(.+) *\),? *' ) check_constraints = [] # NOTE: we aren't using re.S here because we actually are |
