diff --git a/go-manual/modules/ROOT/pages/result-summary.adoc b/go-manual/modules/ROOT/pages/result-summary.adoc index 56d92ec8..21e9aff9 100644 --- a/go-manual/modules/ROOT/pages/result-summary.adoc +++ b/go-manual/modules/ROOT/pages/result-summary.adoc @@ -154,11 +154,21 @@ For more information and examples, see link:{neo4j-docs-base-uri}/cypher-manual/ == Notifications -The method `ResultSummary.Notifications()` returns a list of link:{neo4j-docs-base-uri}/status-codes/current/notifications[notifications coming from the server], if any were raised by the execution of the query. -These include recommendations for performance improvements, warnings about the usage of deprecated features, and other hints about sub-optimal usage of Neo4j. -Each notification comes as a link:https://pkg.go.dev/github.com/neo4j/neo4j-go-driver/v5/neo4j#Notification[`Notification`] object. +After executing a query, the server can return link:{neo4j-docs-base-uri}/status-codes/current/notifications/[notifications] alongside the query result. +Notifications contain recommendations for performance improvements, warnings about the usage of deprecated features, and other hints about sub-optimal usage of Neo4j. + +[TIP] +For driver version >= 5.25 and server version >= 5.23, two forms of notifications are available (_Neo4j status codes_ and _GQL status codes_). +For earlier versions, only _Neo4j status codes_ are available. + +GQL status codes are planned to supersede Neo4j status codes. .An unbounded shortest path raises a performance notification +[.tabbed-example] +===== +[.include-with-neo4j-status-code] +====== +The method `Summary.Notifications()` returns a list of link:https://pkg.go.dev/github.com/neo4j/neo4j-go-driver/v5/neo4j#Notification[`Notification`] objects. + [source, go, role=nocollapse] ---- result, _ := neo4j.ExecuteQuery(ctx, driver, ` @@ -184,16 +194,81 @@ Category: PERFORMANCE */ ---- +====== +[.include-with-GQL-status-code] +====== + +With version >= 5.25, the method `Summary.GqlStatusObjects()` returns a list of link:https://pkg.go.dev/github.com/neo4j/neo4j-go-driver/v5/neo4j#GqlStatusObject[`GqlStatusObject`]s. +These are GQL-compliant status objects. + +Some (but not all) `GqlStatusObjects` are notifications, whereas some report an _outcome_ status: `00000` for "success", `02000` for "no data", and `00001` for "omitted result". +`Summary.GqlStatusObjects()` always contains at least one entry, containing the outcome status. + +[source, go, role=nocollapse] +---- +result, _ := neo4j.ExecuteQuery(ctx, driver, ` + MATCH p=shortestPath((:Person {name: 'Alice'})-[*]->(:Person {name: 'Bob'})) + RETURN p + `, nil, + neo4j.EagerResultTransformer, + neo4j.ExecuteQueryWithDatabase("neo4j")) + +for _, status := range result.Summary.GqlStatusObjects() { + fmt.Println("GQLSTATUS:", status.GqlStatus()) + fmt.Println("Description:", status.StatusDescription()) + // Not all statuses are notifications. + fmt.Println("Is notification:", status.IsNotification()) + + // Notification and thus vendor-specific fields. + // These fields are only meaningful for notifications. + if status.IsNotification() == true { + fmt.Println("Position (offset, line, column):", status.Position().Offset(), status.Position().Line(), status.Position().Column()) + fmt.Println("Classification:", status.Classification()) + fmt.Println("Unparsed classification:", status.RawClassification()) + + fmt.Println("Severity:", status.Severity()) + fmt.Println("Unparsed severity:", status.RawSeverity()) + } + // Any raw extra information provided by the server + fmt.Println("Diagnostic record:", status.DiagnosticRecord()) + fmt.Println(strings.Repeat("=", 80)) +} +/* +GQLSTATUS: 02000 +Description: note: no data +Is notification: false +Diagnostic record: map[CURRENT_SCHEMA:/ OPERATION: OPERATION_CODE:0] +================================================================================ +GQLSTATUS: 03N91 +Description: info: unbounded variable length pattern. The provided pattern `(:Person {name: 'Alice'})-[*]->(:Person {name: 'Bob'})` is unbounded. Shortest path with an unbounded pattern may result in long execution times. Use an upper limit (e.g. `[*..5]`) on the number of node hops in your pattern. +Is notification: true +Position (offset, line, column): 26 2 26 +Classification: PERFORMANCE +Unparsed classification: PERFORMANCE +Severity: INFORMATION +Unparsed severity: INFORMATION +Diagnostic record: map[CURRENT_SCHEMA:/ OPERATION: OPERATION_CODE:0 _classification:PERFORMANCE _position:map[column:26 line:2 offset:26] _severity:INFORMATION _status_parameters:map[pat:(:Person {name: 'Alice'})-[*]->(:Person {name: 'Bob'})]] +================================================================================ +*/ +---- + +====== +===== + +[role=label--new-5.7] === Filter notifications By default, the server analyses each query for all categories and severity of notifications. -Starting from version 5.7, you can use the parameters `NotificationsMinSeverity` and/or `NotificationsDisabledCategories` to restrict the severity or category of notifications that you are interested into. -You may disable notifications altogether by setting the minimum severity to `OFF`. -You can use those parameters either when creating a driver instance, or when creating a session. - +Starting from version 5.7, you can use the parameters `NotificationsMinSeverity` and/or `NotificationsDisabledCategories`/`NotificationsDisabledClassifications` to restrict the severity and/or category/classification of notifications that you are interested into. There is a slight performance gain in restricting the amount of notifications the server is allowed to raise. +The severity filter applies to both Neo4j and GQL notifications. +Category and classification filters exist separately only due to the discrepancy in lexicon between GQL and Neo4j; both filters affect either form of notification though, so you should use only one of them. +You can use any of those parameters either when creating a `Driver` instance, or when creating a session. + +You can disable notifications altogether by setting the minimum severity to `"OFF"`. + .Allow only `Warning` notifications, but not of `Hint` or `Generic` category [source, go] ---- @@ -207,15 +282,15 @@ driverNot, _ := neo4j.NewDriverWithContext( dbUri, neo4j.BasicAuth(dbUser, dbPassword, ""), func (conf *config.Config) { - conf.NotificationsDisabledCategories = notifications.DisableCategories(notifications.Hint, notifications.Generic) - conf.NotificationsMinSeverity = notifications.WarningLevel + conf.NotificationsMinSeverity = notifications.WarningLevel // or "OFF" to disable entirely + conf.NotificationsDisabledClassifications = notifications.DisableClassifications(notifications.Hint, notifications.Generic) // filters categories as well }) // At session level sessionNot := driver.NewSession(ctx, neo4j.SessionConfig{ - NotificationsMinSeverity: notifications.WarningLevel, - NotificationsDisabledCategories: notifications.DisableCategories(notifications.Hint, notifications.Generic), + NotificationsMinSeverity: notifications.WarningLevel, // or "OFF" to disable entirely + NotificationsDisabledClassifications: notifications.DisableClassifications(notifications.Hint, notifications.Generic), // filters categories as well DatabaseName: "neo4j", // always provide the database name }) ---- diff --git a/java-manual/modules/ROOT/pages/result-summary.adoc b/java-manual/modules/ROOT/pages/result-summary.adoc index a1bf508f..d2e4a937 100644 --- a/java-manual/modules/ROOT/pages/result-summary.adoc +++ b/java-manual/modules/ROOT/pages/result-summary.adoc @@ -145,11 +145,21 @@ For more information and examples, see link:{neo4j-docs-base-uri}/cypher-manual/ == Notifications -The method `ResultSummary.notifications()` returns a list of link:{neo4j-docs-base-uri}/status-codes/current/notifications[notifications coming from the server], if any were raised by the execution of the query. -These include recommendations for performance improvements, warnings about the usage of deprecated features, and other hints about sub-optimal usage of Neo4j. -Each notification comes as a link:https://neo4j.com/docs/api/java-driver/current/org.neo4j.driver/org/neo4j/driver/summary/Notification.html[`Notification`] object. +After executing a query, the server can return link:{neo4j-docs-base-uri}/status-codes/current/notifications/[notifications] alongside the query result. +Notifications contain recommendations for performance improvements, warnings about the usage of deprecated features, and other hints about sub-optimal usage of Neo4j. + +[TIP] +For driver version >= 5.25 and server version >= 5.23, two forms of notifications are available (_Neo4j status codes_ and _GQL status codes_). +For earlier versions, only _Neo4j status codes_ are available. + +GQL status codes are planned to supersede Neo4j status codes. .An unbounded shortest path raises a performance notification +[.tabbed-example] +===== +[.include-with-neo4j-status-code] +====== +The method `ResultSummary.notifications()` returns a list of link:https://neo4j.com/docs/api/java-driver/current/org.neo4j.driver/org/neo4j/driver/summary/Notification.html[`Notification`] objects. + [source, java, role=nocollapse] ---- var result = driver.executableQuery(""" @@ -161,7 +171,6 @@ var result = driver.executableQuery(""" .execute(); var notifications = result.summary().notifications(); System.out.println(notifications); - /* [ code=Neo.ClientNotification.Statement.UnboundedVariableLengthPattern, @@ -177,17 +186,88 @@ System.out.println(notifications); */ ---- +====== +[.include-with-GQL-status-code] +====== + +With version >= 5.25, the method `ResultSummary.gqlStatusObjects()` returns an ordered set of GQL-compliant status objects. + +The set can contain both link:https://neo4j.com/docs/api/java-driver/current/org.neo4j.driver/org/neo4j/driver/summary/Notification.html[`Notification`] objects and link:https://neo4j.com/docs/api/java-driver/current/org.neo4j.driver/org/neo4j/driver/summary/GqlStatusObject.html[`GqlStatusObject`] objects. +The latter encodes the query's _outcome_ status: `00000` for "success", `02000` for "no data", and `00001` for "omitted result". +The set always contains at least one entry, containing the outcome status. + +[source, java, role=nocollapse] +---- +var result = driver.executableQuery(""" + MATCH p=shortestPath((:Person {name: $start})-[*]->(:Person {name: $end})) + RETURN p + """) + .withParameters(Map.of("start", "Alice", "end", "Bob")) + .withConfig(QueryConfig.builder().withDatabase("neo4j").build()) + .execute(); +var statuses = result.summary().gqlStatusObjects(); +System.out.println(statuses); +/* +[ + InternalGqlStatusObject{gqlStatus='02000', statusDescription='note: no data', diagnosticRecord={OPERATION_CODE="0", OPERATION="", CURRENT_SCHEMA="/"}}, + code=Neo.ClientNotification.Statement.UnboundedVariableLengthPattern, title=The provided pattern is unbounded, consider adding an upper limit to the number of node hops., description=Using shortest path with an unbounded pattern will likely result in long execution times. It is recommended to use an upper limit to the number of node hops in your pattern., severityLevel=InternalNotificationSeverity[type=INFORMATION, level=800], rawSeverityLevel=INFORMATION, classification=PERFORMANCE, rawClassification=PERFORMANCE, position={offset=21, line=1, column=22} +] +*/ +---- + +====== +===== + +[role=label--new-5.7] === Filter notifications By default, the server analyses each query for all categories and severity of notifications. -Starting from version 5.7, you can use the configuration method `.withNotificationConfig(link:https://neo4j.com/docs/api/java-driver/current/org.neo4j.driver/org/neo4j/driver/NotificationConfig.html[NotificationConfig])` to restrict the severity or category of notifications that you are interested into, or disable them altogether. There is a slight performance gain in restricting the amount of notifications the server is allowed to raise. +Starting from version 5.22, you can use the configuration methods link:https://neo4j.com/docs/api/java-driver/current/org.neo4j.driver/org/neo4j/driver/Config.ConfigBuilder.html#withMinimumNotificationSeverity(org.neo4j.driver.NotificationSeverity)[`.withMinimumNotificationSeverity()`] and link:https://neo4j.com/docs/api/java-driver/5.24/org.neo4j.driver/org/neo4j/driver/Config.ConfigBuilder.html#withDisabledNotificationClassifications(java.util.Set)[`.withDisabledNotificationClassification()`] to tweak the severity and/or category/classification of notifications that you are interested into, or to disable them altogether. +There is a slight performance gain in restricting the amount of notifications the server is allowed to raise. + +The severity filter applies to both Neo4j and GQL notifications. +The category filter acts on both categories and classifications. + +You can call the methods both on a `Config` object when creating a `Driver` instance, and on a `SessionConfig` object when creating a session. -The `NotificationConfig` interface provides the methods `.enableMinimumSeverity(link:https://neo4j.com/docs/api/java-driver/current/org.neo4j.driver/org/neo4j/driver/NotificationSeverity.html[NotificationSeverity])`, `.disableCategories(Set)`, and `.disableAllConfig()` to set the configuration. +.Allow only `WARNING` notifications, but not of `HINT` or `GENERIC` classifications +[source, java] +---- +// import java.util.Set +// import org.neo4j.driver.Config; +// import org.neo4j.driver.NotificationClassification; +// import org.neo4j.driver.NotificationConfig; +// import org.neo4j.driver.NotificationSeverity; +// import org.neo4j.driver.SessionConfig; + +// at `Driver` level +var driver = GraphDatabase.driver( + dbUri, AuthTokens.basic(dbUser, dbPassword), + Config.builder() + .withMinimumNotificationSeverity(NotificationSeverity.WARNING) // NotificationSeverity.OFF to disable entirely + .withDisabledNotificationClassifications(Set.of(NotificationClassification.PERFORMANCE, NotificationClassification.GENERIC)) // filters categories as well + .build() +); + +// at `Session` level +var session = driver.session( + SessionConfig.builder() + .withDatabase("neo4j") + .withMinimumNotificationSeverity(NotificationSeverity.WARNING) // NotificationSeverity.OFF to disable entirely + .withDisabledNotificationClassifications(Set.of(NotificationClassification.PERFORMANCE, NotificationClassification.GENERIC)) // filters categories as well + .build() +); +---- + +.Notifications filtering on versions earlier than 5.22 +[%collapsible] +==== +For versions earlier than 5.22, notification filtering is done via the configuration method link:https://neo4j.com/docs/api/java-driver/current/org.neo4j.driver/org/neo4j/driver/Config.ConfigBuilder.html#withNotificationConfig(org.neo4j.driver.NotificationConfig)[`.withNotificationConfig()`] (versions 5.7+). -You can call `.withNotificationConfig()` both on a `Config` object when creating a `Driver` instance, and on a `SessionConfig` object when creating a session. +The `NotificationConfig` interface provides the methods `.enableMinimumSeverity()`, `.disableCategories()`, and `.disableAllConfig()` to set the configuration. -.Allow only `WARNING` (and over) notifications, but not of `HINT` or `GENERIC` category +.Allow only `WARNING` notifications, but not of `HINT` or `GENERIC` category [source, java] ---- // import java.util.Set @@ -241,3 +321,5 @@ var session = driver.session( .build() ); ---- + +==== diff --git a/javascript-manual/modules/ROOT/pages/result-summary.adoc b/javascript-manual/modules/ROOT/pages/result-summary.adoc index ae0259b9..ddbe0666 100644 --- a/javascript-manual/modules/ROOT/pages/result-summary.adoc +++ b/javascript-manual/modules/ROOT/pages/result-summary.adoc @@ -151,11 +151,21 @@ For more information and examples, see link:{neo4j-docs-base-uri}/cypher-manual/ == Notifications -The property `ResultSummary.notifications` contains a list of link:{neo4j-docs-base-uri}/status-codes/current/notifications[notifications coming from the server], if any were raised by the execution of the query. -These include recommendations for performance improvements, warnings about the usage of deprecated features, and other hints about sub-optimal usage of Neo4j. -Each notification comes as a link:{neo4j-docs-base-uri}/api/javascript-driver/current/class/lib6/result-summary.js~Notification.html[`Notification`] object. +After executing a query, the server can return link:{neo4j-docs-base-uri}/status-codes/current/notifications/[notifications] alongside the query result. +Notifications contain recommendations for performance improvements, warnings about the usage of deprecated features, and other hints about sub-optimal usage of Neo4j. + +[TIP] +For driver version >= 5.25 and server version >= 5.23, two forms of notifications are available (_Neo4j status codes_ and _GQL status codes_). +For earlier versions, only _Neo4j status codes_ are available. + +GQL status codes are planned to supersede Neo4j status codes. .An unbounded shortest path raises a performance notification +[.tabbed-example] +===== +[.include-with-neo4j-status-code] +====== +The property `ResultSummary.notifications` contains a list of link:{neo4j-docs-base-uri}/api/javascript-driver/current/class/lib6/result-summary.js~Notification.html[`Notification`] objects. + [source, javascript, role=nocollapse] ---- let { records, summary } = await driver.executeQuery(` @@ -182,16 +192,79 @@ console.log(summary.notifications) */ ---- +====== +[.include-with-GQL-status-code] +====== + +With version >= 5.25, the property `ResultSummary.gqlStatusObjects` contains a list of link:https://neo4j.com/docs/api/javascript-driver/current/class/lib6/notification.js~GqlStatusObject.html[`GqlStatusObject`]s. +These are GQL-compliant status objects. + +Some (but not all) `GqlStatusObjects` are notifications, whereas some report an _outcome_ status: `00000` for "success", `02000` for "no data", and `00001` for "omitted result". +`Summary.GqlStatusObjects()` always contains at least one entry, containing the outcome status. +[source, javascript, role=nocollapse] +---- +let { records, summary } = await driver.executeQuery(` + MATCH p=shortestPath((:Person {name: 'Alice'})-[*]->(:Person {name: 'Bob'})) + RETURN p + `, {}, + { database: 'neo4j' } +) +console.log(summary.gqlStatusObjects) +/* +[ + GqlStatusObject { + gqlStatus: '02000', + statusDescription: 'note: no data', + diagnosticRecord: { OPERATION: '', OPERATION_CODE: '0', CURRENT_SCHEMA: '/' }, + position: undefined, + severity: 'UNKNOWN', + rawSeverity: undefined, + classification: 'UNKNOWN', + rawClassification: undefined, + isNotification: false + }, + GqlStatusObject { + gqlStatus: '03N91', + statusDescription: "info: unbounded variable length pattern. The provided pattern `(:Person {name: 'Alice'})-[*]->(:Person {name: 'Bob'})` is unbounded. Shortest path with an unbounded pattern may result in long execution times. Use an upper limit (e.g. `[*..5]`) on the number of node hops in your pattern.", + diagnosticRecord: { + OPERATION: '', + OPERATION_CODE: '0', + CURRENT_SCHEMA: '/', + _classification: 'PERFORMANCE', + _status_parameters: [Object], + _severity: 'INFORMATION', + _position: [Object] + }, + position: { offset: 24, line: 2, column: 24 }, + severity: 'INFORMATION', + rawSeverity: 'INFORMATION', + classification: 'PERFORMANCE', + rawClassification: 'PERFORMANCE', + isNotification: true + } +] +*/ +---- + +====== +===== + + +[role=label--new-5.7] === Filter notifications By default, the server analyses each query for all categories and severity of notifications. -Starting from version 5.7, you can use the parameter `notificationsFilter` to restrict the severity or category of notifications that you are interested into. You may disable notifications altogether by setting the minimum severity to `OFF`. -You can use that parameter either when creating a `Driver` instance, or when creating a session. - +Starting from version 5.7, you can use the parameters `minimumSeverityLevel` and/or `disabledCategories`/`disabledClassifications` to restrict the severity and/or category/classification of notifications that you are interested into. There is a slight performance gain in restricting the amount of notifications the server is allowed to raise. -.Allow only `WARNING` notifications, but not of `HINT` or `GENERIC` category +The severity filter applies to both Neo4j and GQL notifications. +Category and classification filters exist separately only due to the discrepancy in lexicon between GQL and Neo4j; both filters affect either form of notification though, so you should use only one of them. +You can use any of those parameters either when creating a `Driver` instance, or when creating a session. + +You can disable notifications altogether by setting the minimum severity to `'OFF'`. + +.Allow only `WARNING` notifications, but not of `HINT` or `GENERIC` classifications [source, javascript] ---- // at driver level @@ -199,7 +272,7 @@ let driver = neo4j.driver( URI, neo4j.auth.basic(USER, PASSWORD), { notificationsFilter: { minimumSeverityLevel: 'WARNING', // or 'OFF' to disable entirely - disabledCategories: ['HINT', 'GENERIC'] + disabledClassifications: ['HINT', 'GENERIC'] // filters categories as well } } ) @@ -209,7 +282,7 @@ let session = driver.session({ database: 'neo4j', notificationsFilter: { minimumSeverityLevel: 'WARNING', // or 'OFF' to disable entirely - disabledCategories: ['HINT', 'GENERIC'] + disabledClassifications: ['HINT', 'GENERIC'] // filters categories as well } }) ---- diff --git a/python-manual/modules/ROOT/pages/result-summary.adoc b/python-manual/modules/ROOT/pages/result-summary.adoc index 89f589bf..445c52bb 100644 --- a/python-manual/modules/ROOT/pages/result-summary.adoc +++ b/python-manual/modules/ROOT/pages/result-summary.adoc @@ -133,11 +133,21 @@ For more information and examples, see link:{neo4j-docs-base-uri}/cypher-manual/ == Notifications -The property `ResultSummary.summary_notifications` contains a list of link:{neo4j-docs-base-uri}/status-codes/current/notifications[notifications coming from the server], if any were raised by the execution of the query. -These include recommendations for performance improvements, warnings about the usage of deprecated features, and other hints about sub-optimal usage of Neo4j. -Each notification comes as a link:{neo4j-docs-base-uri}/api/python-driver/current/api.html#neo4j.SummaryNotification[`SummaryNotification`] object. +After executing a query, the server can return link:{neo4j-docs-base-uri}/status-codes/current/notifications/[notifications] alongside the query result. +Notifications contain recommendations for performance improvements, warnings about the usage of deprecated features, and other hints about sub-optimal usage of Neo4j. + +[TIP] +For driver version >= 5.25 and server version >= 5.23, two forms of notifications are available (_Neo4j status codes_ and _GQL status codes_). +For earlier versions, only _Neo4j status codes_ are available. + +GQL status codes are planned to supersede Neo4j status codes. .An unbounded shortest path raises a performance notification +[.tabbed-example] +===== +[.include-with-neo4j-status-code] +====== +The property `ResultSummary.summary_notifications` contains a list of link:{neo4j-docs-base-uri}/api/python-driver/current/api.html#neo4j.SummaryNotification[`SummaryNotification`] objects. + [source, python, role=nocollapse] ---- records, summary, keys = driver.execute_query(""" @@ -145,7 +155,6 @@ records, summary, keys = driver.execute_query(""" RETURN p """, database_="neo4j" ) -print(summary.summary_notifications) """ [SummaryNotification( title='The provided pattern is unbounded, consider adding an upper limit to the number of node hops.', @@ -160,29 +169,96 @@ print(summary.summary_notifications) """ ---- +====== +[.include-with-GQL-status-code] +====== + +With version >= 5.25, the property `ResultSummary.gql_status_objects` contains a sequence of link:{neo4j-docs-base-uri}/api/python-driver/current/api.html#GqlStatusObject[`GqlStatusObject`]s. +These are GQL-compliant status objects. + +Some (but not all) `GqlStatusObjects` are notifications, whereas some report an _outcome_ status: `00000` for "success", `02000` for "no data", and `00001` for "omitted result". +`ResultSummary.gql_status_objects` always contains at least one entry, containing the outcome status. + +[source, python, role=nocollapse] +---- +records, summary, keys = driver.execute_query(""" + MATCH p=shortestPath((:Person {name: 'Alice'})-[*]->(:Person {name: 'Bob'})) + RETURN p + """, database_="neo4j" +) +for status in summary.gql_status_objects: + print("GQLSTATUS:", status.gql_status) + print("Description:", status.status_description) + # Not all statuses are notifications. + print("Is notification:", status.is_notification) + + # Notification and thus vendor-specific fields. + # These fields are only meaningful for notifications. + if status.is_notification: + # The position in the query that caused the notification. + print("Position:", status.position) + + # The notification's classification is counterpart to `neo4j.NotificationCategory`. + # However, the term `category` has a different meaning in the context of GQL. + print("Classification:", status.classification) + print("Unparsed classification:", status.raw_classification) + + print("Severity:", status.severity) + print("Unparsed severity:", status.raw_severity) + + # Any raw extra information provided by the DBMS: + print("Diagnostic record:", status.diagnostic_record) + print("=" * 80) +""" +GQLSTATUS: 02000 +Description: note: no data +Is notification: False +Diagnostic record: {'OPERATION': '', 'OPERATION_CODE': '0', 'CURRENT_SCHEMA': '/'} +================================================================================ +GQLSTATUS: 03N91 +Description: info: unbounded variable length pattern. The provided pattern `(:Person {name: 'Alice'})-[*]->(:Person {name: 'Bob'})` is unbounded. Shortest path with an unbounded pattern may result in long execution times. Use an upper limit (e.g. `[*..5]`) on the number of node hops in your pattern. +Is notification: True +Position: line: 1, column: 22, offset: 21 +Classification: NotificationClassification.PERFORMANCE +Unparsed classification: PERFORMANCE +Severity: NotificationSeverity.INFORMATION +Unparsed severity: INFORMATION +Diagnostic record: {'_classification': 'PERFORMANCE', '_status_parameters': {'pat': "(:Person {name: 'Alice'})-[*]->(:Person {name: 'Bob'})"}, '_severity': 'INFORMATION', '_position': {'offset': 21, 'line': 1, 'column': 22}, 'OPERATION': '', 'OPERATION_CODE': '0', 'CURRENT_SCHEMA': '/'} +================================================================================ +""" +---- + +====== +===== + +[role=label--new-5.7] === Filter notifications By default, the server analyses each query for all categories and severity of notifications. -Starting from version 5.7, you can use the parameters `notifications_min_severity` and/or `notifications_disabled_categories` to restrict the severity or category of notifications that you are interested into. -You may disable notifications altogether by setting the minimum severity to `OFF`. -You can use those parameters either when creating a `Driver` instance, or when creating a session. - +Starting from version 5.7, you can use the parameters `notifications_min_severity` and/or `notifications_disabled_categories`/`notifications_disabled_classifications` to restrict the severity and/or category/classification of notifications that you are interested into. There is a slight performance gain in restricting the amount of notifications the server is allowed to raise. +The severity filter applies to both Neo4j and GQL notifications. +Category and classification filters exist separately only due to the discrepancy in lexicon between GQL and Neo4j; both filters affect either form of notification though, so you should use only one of them. If you provide both a category and a classification filter, their contents will be merged. +You can use any of those parameters either when creating a `Driver` instance, or when creating a session. + +You can disable notifications altogether by setting the minimum severity to `'OFF'`. + .Allow only `WARNING` notifications, but not of `HINT` or `GENERIC` category [source, python] ---- +# at driver level driver = neo4j.GraphDatabase.driver( URI, auth=AUTH, - notifications_min_severity='WARNING', # or 'OFF' to disable - notifications_disabled_categories=['HINT', 'GENERIC'] + notifications_min_severity='WARNING', # or 'OFF' to disable entirely + notifications_disabled_classifications=['HINT', 'GENERIC'], # filters categories as well ) # at session level session = driver.session( database="neo4j", - notifications_min_severity='INFORMATION', - notifications_disabled_categories=['HINT'] + notifications_min_severity='INFORMATION', # or 'OFF' to disable entirely + notifications_disabled_classifications=['HINT'] # filters categories as well ) ----