diff options
Diffstat (limited to 'django/db/backends/postgresql')
| -rw-r--r-- | django/db/backends/postgresql/base.py | 26 | ||||
| -rw-r--r-- | django/db/backends/postgresql/introspection.py | 4 | ||||
| -rw-r--r-- | django/db/backends/postgresql/operations.py | 4 |
3 files changed, 18 insertions, 16 deletions
diff --git a/django/db/backends/postgresql/base.py b/django/db/backends/postgresql/base.py index a0b5e4154e..cafa4c7a9c 100644 --- a/django/db/backends/postgresql/base.py +++ b/django/db/backends/postgresql/base.py @@ -61,8 +61,8 @@ else: psycopg2.extensions.register_adapter(SafeString, psycopg2.extensions.QuotedString) psycopg2.extras.register_uuid() - # Register support for inet[] manually so we don't have to handle the Inet() - # object on load all the time. + # Register support for inet[] manually so we don't have to handle the + # Inet() object on load all the time. INETARRAY_OID = 1041 INETARRAY = psycopg2.extensions.new_array_type( (INETARRAY_OID,), @@ -71,7 +71,8 @@ else: ) psycopg2.extensions.register_type(INETARRAY) -# Some of these import psycopg, so import them after checking if it's installed. +# Some of these import psycopg, so import them after checking if it's +# installed. from .client import DatabaseClient # NOQA isort:skip from .creation import DatabaseCreation # NOQA isort:skip from .features import DatabaseFeatures # NOQA isort:skip @@ -90,9 +91,10 @@ class DatabaseWrapper(BaseDatabaseWrapper): vendor = "postgresql" display_name = "PostgreSQL" # This dictionary maps Field objects to their associated PostgreSQL column - # types, as strings. Column-type strings can contain format strings; they'll - # be interpolated against the values of Field.__dict__ before being output. - # If a column type is set to None, it won't be included in the output. + # types, as strings. Column-type strings can contain format strings; + # they'll be interpolated against the values of Field.__dict__ before being + # output. If a column type is set to None, it won't be included in the + # output. data_types = { "AutoField": "integer", "BigAutoField": "bigint", @@ -150,13 +152,13 @@ class DatabaseWrapper(BaseDatabaseWrapper): } # The patterns below are used to generate SQL pattern lookup clauses when - # the right-hand side of the lookup isn't a raw string (it might be an expression - # or the result of a bilateral transformation). - # In those cases, special characters for LIKE operators (e.g. \, *, _) should be - # escaped on database side. + # the right-hand side of the lookup isn't a raw string (it might be an + # expression or the result of a bilateral transformation). In those cases, + # special characters for LIKE operators (e.g. \, *, _) should be escaped on + # database side. # - # Note: we use str.format() here for readability as '%' is used as a wildcard for - # the LIKE operator. + # Note: we use str.format() here for readability as '%' is used as a + # wildcard for the LIKE operator. pattern_esc = ( r"REPLACE(REPLACE(REPLACE({}, E'\\', E'\\\\'), E'%%', E'\\%%'), E'_', E'\\_')" ) diff --git a/django/db/backends/postgresql/introspection.py b/django/db/backends/postgresql/introspection.py index aaa3d93e60..82013eb191 100644 --- a/django/db/backends/postgresql/introspection.py +++ b/django/db/backends/postgresql/introspection.py @@ -154,8 +154,8 @@ class DatabaseIntrospection(BaseDatabaseIntrospection): def get_relations(self, cursor, table_name): """ - Return a dictionary of {field_name: (field_name_other_table, other_table)} - representing all foreign keys in the given table. + Return a dictionary of {field_name: (field_name_other_table, + other_table)} representing all foreign keys in the given table. """ cursor.execute( """ diff --git a/django/db/backends/postgresql/operations.py b/django/db/backends/postgresql/operations.py index 9db755bb89..a8c073e418 100644 --- a/django/db/backends/postgresql/operations.py +++ b/django/db/backends/postgresql/operations.py @@ -221,8 +221,8 @@ class DatabaseOperations(BaseDatabaseOperations): return ["%s;" % " ".join(sql_parts)] def sequence_reset_by_name_sql(self, style, sequences): - # 'ALTER SEQUENCE sequence_name RESTART WITH 1;'... style SQL statements - # to reset sequence indices + # 'ALTER SEQUENCE sequence_name RESTART WITH 1;'... style SQL + # statements to reset sequence indices sql = [] for sequence_info in sequences: table_name = sequence_info["table"] |
