diff --git a/modules/ROOT/content-nav.adoc b/modules/ROOT/content-nav.adoc index fb5f6516f..c153f7791 100644 --- a/modules/ROOT/content-nav.adoc +++ b/modules/ROOT/content-nav.adoc @@ -123,6 +123,7 @@ *** xref:database-administration/composite-databases/concepts.adoc[] *** xref:database-administration/composite-databases/create-composite-databases.adoc[] *** xref:database-administration/composite-databases/list-composite-databases.adoc[] +*** xref:database-administration/composite-databases/alter-composite-databases.adoc[] *** xref:database-administration/composite-databases/delete-composite-databases.adoc[] *** xref:database-administration/composite-databases/querying-composite-databases.adoc[] *** xref:database-administration/composite-databases/sharding-with-copy.adoc[] diff --git a/modules/ROOT/images/privileges_grant_and_deny_syntax_dbms_privileges.svg b/modules/ROOT/images/privileges_grant_and_deny_syntax_dbms_privileges.svg index 3d08de6ec..04def26cd 100644 --- a/modules/ROOT/images/privileges_grant_and_deny_syntax_dbms_privileges.svg +++ b/modules/ROOT/images/privileges_grant_and_deny_syntax_dbms_privileges.svg @@ -1,142 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + \ No newline at end of file diff --git a/modules/ROOT/images/privileges_hierarchy_dbms.svg b/modules/ROOT/images/privileges_hierarchy_dbms.svg index 77c37a377..1f7f0057d 100644 --- a/modules/ROOT/images/privileges_hierarchy_dbms.svg +++ b/modules/ROOT/images/privileges_hierarchy_dbms.svg @@ -1,750 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + \ No newline at end of file diff --git a/modules/ROOT/pages/authentication-authorization/dbms-administration.adoc b/modules/ROOT/pages/authentication-authorization/dbms-administration.adoc index 2e7968fe5..78435e718 100644 --- a/modules/ROOT/pages/authentication-authorization/dbms-administration.adoc +++ b/modules/ROOT/pages/authentication-authorization/dbms-administration.adoc @@ -26,6 +26,8 @@ CREATE ROLE databaseDropper IF NOT EXISTS; CREATE ROLE compositeDatabaseDropper IF NOT EXISTS; CREATE ROLE databaseModifier IF NOT EXISTS; CREATE ROLE accessModifier IF NOT EXISTS; +CREATE ROLE languageModifier IF NOT EXISTS; +CREATE ROLE compositeDatabaseModifier IF NOT EXISTS; CREATE ROLE compositeDatabaseManager IF NOT EXISTS; CREATE ROLE databaseManager IF NOT EXISTS; CREATE ROLE aliasAdder IF NOT EXISTS; @@ -67,9 +69,9 @@ All DBMS privileges are relevant system-wide. Like user management, they do not belong to one specific database or graph. For more details on the differences between graphs, databases, and the DBMS, refer to link:{neo4j-docs-base-uri}/cypher-manual/current/introduction/cypher_neo4j/[Cypher Manual -> Cypher and Neo4j]. -image::privileges_grant_and_deny_syntax_dbms_privileges.svg[title="Syntax of GRANT and DENY DBMS Privileges"] +image::privileges_grant_and_deny_syntax_dbms_privileges.svg[width="800", title="Syntax of GRANT and DENY DBMS Privileges"] -image::privileges_hierarchy_dbms.svg[title="DBMS privileges hierarchy"] +image::privileges_hierarchy_dbms.svg[width="800", title="DBMS privileges hierarchy"] The xref:authentication-authorization/built-in-roles.adoc#access-control-built-in-roles-admin[`admin` role] has a number of built-in privileges. These include: @@ -864,19 +866,19 @@ For more details about the syntax descriptions, see xref:database-administration GRANT [IMMUTABLE] CREATE DATABASE ON DBMS TO role[, ...] -| Enables the specified roles to create new standard databases and aliases. +| Enables the specified roles to create new standard databases. | [source, syntax, role=noheader] GRANT [IMMUTABLE] DROP DATABASE ON DBMS TO role[, ...] -| Enables the specified roles to delete standard databases and aliases. +| Enables the specified roles to delete standard databases. | [source, syntax, role=noheader] GRANT [IMMUTABLE] ALTER DATABASE ON DBMS TO role[, ...] -| Enables the specified roles to modify standard databases and aliases. +| Enables the specified roles to modify standard databases. | [source, syntax, role=noheader] GRANT [IMMUTABLE] SET DATABASE ACCESS @@ -884,6 +886,12 @@ GRANT [IMMUTABLE] SET DATABASE ACCESS TO role[, ...] | Enables the specified roles to modify access to standard databases. +| [source, syntax, role=noheader] +GRANT [IMMUTABLE] SET DATABASE DEFAULT LANGUAGE + ON DBMS + TO role[, ...] +| Enables the specified roles to set the default query language on a standard database. + | [source, syntax, role=noheader] GRANT CREATE COMPOSITE DATABASE ON DBMS @@ -896,22 +904,28 @@ GRANT DROP COMPOSITE DATABASE TO role[, ...] | Enables the specified roles to delete composite databases. +| [source, syntax, role=noheader] +GRANT ALTER COMPOSITE DATABASE + ON DBMS + TO role[, ...] +| Enables the specified roles to modify composite databases. + | [source, syntax, role=noheader] GRANT COMPOSITE DATABASE MANAGEMENT ON DBMS TO role[, ...] -| Enables the specified roles to create and delete composite databases. +| Enables the specified roles to create, delete or modify composite databases. | [source, syntax, role=noheader] GRANT [IMMUTABLE] DATABASE MANAGEMENT ON DBMS TO role[, ...] -| Enables the specified roles to create, delete, and modify databases and aliases. +| Enables the specified roles to create, delete, and modify databases. |=== -The ability to create standard databases and aliases can be granted via the `CREATE DATABASE` privilege. +The ability to create standard databases can be granted via the `CREATE DATABASE` privilege. See an example: [source, cypher, role=noplay] @@ -919,7 +933,7 @@ See an example: GRANT CREATE DATABASE ON DBMS TO databaseAdder ---- -The resulting role has privileges that only allow creating standard databases and aliases. +The resulting role has privileges that only allow creating standard databases. List all privileges for the role `databaseAdder` as commands by using the following query: [source, cypher, role=noplay] @@ -959,7 +973,7 @@ SHOW ROLE compositeDatabaseAdder PRIVILEGES AS COMMANDS a|Rows: 1 |=== -The ability to delete standard databases and aliases can be granted via the `DROP DATABASE` privilege. +The ability to delete standard databases can be granted via the `DROP DATABASE` privilege. See an example: [source, cypher, role=noplay] @@ -967,7 +981,7 @@ See an example: GRANT DROP DATABASE ON DBMS TO databaseDropper ---- -The resulting role has privileges that only allow deleting standard databases and aliases. +The resulting role has privileges that only allow deleting standard databases. List all privileges for the role `databaseDropper` as commands by using the following query: [source, cypher, role=noplay] @@ -1007,7 +1021,7 @@ SHOW ROLE compositeDatabaseDropper PRIVILEGES AS COMMANDS a|Rows: 1 |=== -The ability to modify standard databases and aliases can be granted via the `ALTER DATABASE` privilege. +The ability to modify standard databases can be granted via the `ALTER DATABASE` privilege. See an example: [source, cypher, role=noplay] @@ -1015,7 +1029,7 @@ See an example: GRANT ALTER DATABASE ON DBMS TO databaseModifier ---- -The resulting role has privileges that only allow modifying standard databases and aliases. +The resulting role has privileges that only allow modifying standard databases. List all privileges for the role `databaseModifier` as commands by using the following query: [source, cypher, role=noplay] @@ -1055,6 +1069,54 @@ SHOW ROLE accessModifier PRIVILEGES AS COMMANDS a|Rows: 1 |=== +The ability to modify the default language to standard databases can be granted via the `SET DATABASE DEFAULT LANGUAGE` privilege. +See an example: + +[source, cypher, role=noplay] +---- +GRANT SET DATABASE DEFAULT LANGUAGE ON DBMS TO languageModifier +---- + +The resulting role has privileges that only allow modifying default language to standard databases. +List all privileges for the role `languageModifier` as commands by using the following query: + +[source, cypher, role=noplay] +---- +SHOW ROLE languageModifier PRIVILEGES AS COMMANDS +---- + +.Result +[options="header,footer", width="100%", cols="m"] +|=== +|command +|"GRANT SET DATABASE DEFAULT LANGUAGE ON DBMS TO `languageModifier`" +a|Rows: 1 +|=== + +The ability to modify composite databases can be granted via the `ALTER COMPOSITE DATABASE` privilege. +See an example: + +[source, cypher, role=noplay] +---- +GRANT ALTER COMPOSITE DATABASE ON DBMS TO compositeDatabaseModifier +---- + +The resulting role has privileges that only allow modifying composite databases. +List all privileges for the role `compositeDatabaseModifier` as commands by using the following query: + +[source, cypher, role=noplay] +---- +SHOW ROLE compositeDatabaseModifier PRIVILEGES AS COMMANDS +---- + +.Result +[options="header,footer", width="100%", cols="m"] +|=== +|command +|"GRANT ALTER COMPOSITE DATABASE ON DBMS TO `compositeDatabaseModifier`" +a|Rows: 1 +|=== + The ability to create and delete composite databases can be granted via the `COMPOSITE DATABASE MANAGEMENT` privilege. See an example: @@ -1079,7 +1141,7 @@ SHOW ROLE compositeDatabaseManager PRIVILEGES AS COMMANDS a|Rows: 1 |=== -The ability to create, delete, and modify databases and aliases can be granted via the `DATABASE MANAGEMENT` privilege. +The ability to create, delete, and modify databases can be granted via the `DATABASE MANAGEMENT` privilege. See an example: [source, cypher, role=noplay] @@ -1087,7 +1149,7 @@ See an example: GRANT DATABASE MANAGEMENT ON DBMS TO databaseManager ---- -The resulting role has all privileges to manage standard and composite databases as well as aliases. +The resulting role has all privileges to manage standard and composite databases. List all privileges for the role `databaseManager` as commands by using the following query: [source, cypher, role=noplay] @@ -1108,7 +1170,6 @@ a|Rows: 1 The DBMS privileges for alias management can be assigned by using Cypher administrative commands and can be applied to both local and remote aliases. They can be granted, denied and revoked like other privileges. -It is also possible to manage aliases with <>. [NOTE] ==== diff --git a/modules/ROOT/pages/database-administration/aliases/manage-aliases-composite-databases.adoc b/modules/ROOT/pages/database-administration/aliases/manage-aliases-composite-databases.adoc index 6fcf82c0a..4c3576962 100644 --- a/modules/ROOT/pages/database-administration/aliases/manage-aliases-composite-databases.adoc +++ b/modules/ROOT/pages/database-administration/aliases/manage-aliases-composite-databases.adoc @@ -17,6 +17,7 @@ CREATE DATABASE `perennial-flowers`; ---- //// +Aliases in composite databases cannot be assigned default languages, they will always get the default from the composite database. [[manage-aliases-composite-databases-list]] == List database aliases in composite databases @@ -152,14 +153,14 @@ SHOW ALIASES FOR DATABASE YIELD * .Result [role="queryresult"] ---- -+-----------------------------------------------------------------------------------------------------------------------------------+ -| name | composite | database | location | url | user | driver | properties | -+-----------------------------------------------------------------------------------------------------------------------------------+ -| "garden.flowers" | "garden" | "perennial-flowers" | "local" | NULL | NULL | NULL | {perennial: TRUE} | -| "garden.trees" | "garden" | "updatedtrees" | "remote" | "neo4j+s://location:7687" | "alice" | {} | {treeversion: 2} | -| "library.romance" | "library" | "romance-books" | "remote" | "neo4j+s://location:7687" | "alice" | {} | {} | -| "library.sci-fi" | "library" | "sci-fi-books" | "local" | NULL | NULL | NULL | {} | -+-----------------------------------------------------------------------------------------------------------------------------------+ ++-----------------------------------------------------------------------------------------------------------------------------------------------------+ +| name | composite | database | location | url | user | driver | defaultLanguage | properties | ++-----------------------------------------------------------------------------------------------------------------------------------------------------+ +| "garden.flowers" | "garden" | "perennial-flowers" | "local" | NULL | NULL | NULL | NULL | {perennial: TRUE} | +| "garden.trees" | "garden" | "updatedtrees" | "remote" | "neo4j+s://location:7687" | "alice" | {} | NULL | {treeversion: 2} | +| "library.romance" | "library" | "romance-books" | "remote" | "neo4j+s://location:7687" | "alice" | {} | NULL | {} | +| "library.sci-fi" | "library" | "sci-fi-books" | "local" | NULL | NULL | NULL | NULL | {} | ++-----------------------------------------------------------------------------------------------------------------------------------------------------+ ---- [[delete-composite-database-alias]] diff --git a/modules/ROOT/pages/database-administration/aliases/manage-aliases-standard-databases.adoc b/modules/ROOT/pages/database-administration/aliases/manage-aliases-standard-databases.adoc index 4efac4a30..9337c4525 100644 --- a/modules/ROOT/pages/database-administration/aliases/manage-aliases-standard-databases.adoc +++ b/modules/ROOT/pages/database-administration/aliases/manage-aliases-standard-databases.adoc @@ -15,9 +15,9 @@ For more information, see xref:database-administration/aliases/manage-aliases-co A local database alias can be used in all other Cypher commands in place of the target database. Please note that the local database alias will be resolved while executing the command. -Privileges are defined on the database, and not the local database alias. +Privileges and default language are defined on the database, and not the local database alias. -A remote database alias can be used for connecting to a database of a remote Neo4j DBMS, `USE` clauses, setting a user's home database, and defining the access privileges to the remote database. +A remote database alias can be used for connecting to a database of a remote Neo4j DBMS, `USE` clauses, setting a user's home database, and defining the access privileges and default language for queries to the remote database. Remote database aliases require configuration to safely connect to the remote target, which is described in xref::database-administration/aliases/remote-database-alias-configuration.adoc[Connecting remote databases]. It is not possible to impersonate a user on the remote database or to execute an administration command on the remote database via a remote database alias. @@ -52,7 +52,8 @@ DRIVER { connection_pool_idle_test: duration({minutes: 2}), connection_pool_max_size: 10, logging_level: 'info' -}; +} +DEFAULT LANGUAGE CYPHER 25; ---- //// @@ -105,6 +106,11 @@ The driver options for connection to the remote database or `null` if the target List of xref::database-administration/aliases/manage-aliases-standard-databases.adoc#alias-management-create-remote-database-alias-driver-settings[driver settings] allowed for remote database aliases. | MAP +| defaultLanguage +| +The default language for non-constituent remote database aliases or `null` if it is a constituent or local database alias. +| STRING + | properties | Any properties set on the database alias. | MAP @@ -168,13 +174,13 @@ SHOW ALIASES FOR DATABASE YIELD * .Result [role="queryresult"] ---- -+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| name | composite | database | location | url | user | driver | properties | -+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| "films" | NULL | "movies" | "local" | NULL | NULL | NULL | {} | -| "motion pictures" | NULL | "movies" | "local" | NULL | NULL | NULL | {namecontainsspace: TRUE} | -| "movie scripts" | NULL | "scripts" | "remote" | "neo4j+s://location:7687" | "alice" | {connection_pool_idle_test: PT2M, connection_pool_max_size: 10, logging_level: "INFO", ssl_enforced: TRUE, connection_pool_acquisition_timeout: PT1M, connection_timeout: PT5S, connection_max_lifetime: PT1H} | {} | -+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ ++-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| name | composite | database | location | url | user | driver | defaultLanguage | properties | ++-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| "films" | NULL | "movies" | "local" | NULL | NULL | NULL | NULL | {} | +| "motion pictures" | NULL | "movies" | "local" | NULL | NULL | NULL | NULL | {namecontainsspace: TRUE} | +| "movie scripts" | NULL | "scripts" | "remote" | "neo4j+s://location:7687" | "alice" | {connection_pool_idle_test: PT2M, connection_pool_max_size: 10, logging_level: "INFO", ssl_enforced: TRUE, connection_pool_acquisition_timeout: PT1M, connection_timeout: PT5S, connection_max_lifetime: PT1H} | "CYPHER 25" | {} | ++-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ ---- === Show `count` of aliases for a database @@ -289,6 +295,8 @@ SHOW ALIAS `northwind` FOR DATABASE +---------------------------------------------------------------------------+ ---- +Local database aliases cannot be assigned default languages, they will always get the default from their target database. + === Use `IF EXISTS` or `OR REPLACE` when creating database aliases The `CREATE ALIAS` command is optionally idempotent, with the default behavior to fail with an error if the database alias already exists. @@ -355,6 +363,9 @@ SHOW ALIAS `northwind-2022` FOR DATABASE YIELD name, properties A database alias can target a remote database by providing an URL and the credentials of a user on the remote Neo4j DBMS. See xref:database-administration/aliases/remote-database-alias-configuration.adoc[] for the necessary configurations. +Since remote database aliases target databases that are not in this DBMS, they do not fetch the default language from their target like the local database aliases. +Instead, remote database aliases can be given a default language on creation, or they are assigned the default language given by xref:configuration/configuration-settings.adoc#config_db.query.default_language[`db.query.default_language`]. + As with local database aliases, creating remote database aliases allows `IF NOT EXISTS` and `OR REPLACE` clauses. Both check for any remote or local database aliases. @@ -403,7 +414,7 @@ This will be validated when the command is executed. * connection_pool_max_size -- for details, see xref:configuration/configuration-settings.adoc#config_dbms.routing.driver.connection.pool.max_size[dbms.routing.driver.connection.pool.max_size]. * logging_level (For details, see xref:configuration/configuration-settings.adoc#config_dbms.routing.driver.logging.level[dbms.routing.driver.logging.level]) -The driver settings are set in the `DRIVER` clause of the `CREATE ALIAS` or `ALTER ALIAS commands. +The driver settings are set in the `DRIVER` clause of the `CREATE ALIAS` or `ALTER ALIAS` commands. For example, the following query creates a remote database alias using driver settings `connection_timeout` and `connection_pool_max_size` for connecting to the remote database `northwind-graph-2020: @@ -438,6 +449,37 @@ SHOW ALIAS `remote-with-driver-settings` FOR DATABASE YIELD * +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ ---- +==== Set default language for remote database aliases +The default language for the remote database alias can be set using the `DEFAULT LANGUAGE` clause of `CREATE ALIAS` and `ALTER ALIAS` commands. +For example, the following query creates a remote database alias with the default language `CYPHER 25`: + +.Query +[source, cypher] +---- +CREATE ALIAS `remote-with-default-language` FOR DATABASE `northwind-graph-2020` +AT "neo4j+s://location:7687" +USER alice +PASSWORD 'example_secret' +DEFAULT LANGUAGE CYPHER 25 +---- + +When a database alias targeting a remote database has been created, its details can be shown with the `SHOW ALIASES FOR DATABASE` command. + +.Query +[source, cypher] +---- +SHOW ALIAS `remote-with-default-language` FOR DATABASE YIELD name, defaultLanguage +---- + +.Result +[role="queryresult"] +---- ++--------------------------------------------------+ +| name | defaultLanguage | ++--------------------------------------------------+ +| "remote-with-default-language" | "CYPHER 25" | ++--------------------------------------------------+ +---- ==== Set properties for remote database aliases @@ -475,7 +517,7 @@ SHOW ALIAS `remote-northwind-2021` FOR DATABASE YIELD name, properties == Alter database aliases -Database aliases can be altered using `ALTER ALIAS` to change its database target, properties, URL, user credentials, or driver settings. +Database aliases can be altered using `ALTER ALIAS` to change its database target, properties, URL, user credentials, default language, or driver settings. The required privileges are described in the xref:authentication-authorization/dbms-administration.adoc#access-control-dbms-administration-alias-management[The DBMS ALIAS MANAGEMENT privileges]. Only the clauses used will be altered. @@ -559,6 +601,17 @@ ALTER ALIAS `movie scripts` SET DATABASE DRIVER {} ---- +=== Alter default language for remote database aliases + +Example of altering a remote database alias default language. + +.Query +[source, cypher] +---- +ALTER ALIAS `remote-with-default-language` SET DATABASE +DEFAULT LANGUAGE CYPHER 5 +---- + === Alter properties for local and remote database aliases Examples of altering local and remote database alias properties. diff --git a/modules/ROOT/pages/database-administration/composite-databases/alter-composite-databases.adoc b/modules/ROOT/pages/database-administration/composite-databases/alter-composite-databases.adoc new file mode 100644 index 000000000..c3d4a524c --- /dev/null +++ b/modules/ROOT/pages/database-administration/composite-databases/alter-composite-databases.adoc @@ -0,0 +1,26 @@ +:description: This page describes how to alter composite databases. +[role=enterprise-edition not-on-aura] +[[composite-databases-alter]] += Alter composite databases + +Composite databases can be altered using `ALTER DATABASE`. + +== Syntax + +[options="header", width="100%", cols="1m,5a"] +|=== +| Command | Syntax + +| ALTER DATABASE +| +[source, syntax, role="noheader"] +---- +ALTER DATABASE name [IF EXISTS] +SET DEFAULT LANGUAGE CYPHER {5\|25} +[WAIT [n [SEC[OND[S]]]]\|NOWAIT] +---- +|=== + +== Alter database default language +The `ALTER DATABASE` command can be used to set the default Cypher version for a composite database in addition to standard databases. +For more information see link:{neo4j-docs-base-uri}/cypher-manual/current/queries/select-version/#alter-default-cypher-version[Cypher Manual -> Queries -> Select Cypher version]. diff --git a/modules/ROOT/pages/database-administration/composite-databases/create-composite-databases.adoc b/modules/ROOT/pages/database-administration/composite-databases/create-composite-databases.adoc index 881b5841a..6e846695e 100644 --- a/modules/ROOT/pages/database-administration/composite-databases/create-composite-databases.adoc +++ b/modules/ROOT/pages/database-administration/composite-databases/create-composite-databases.adoc @@ -93,6 +93,18 @@ The behavior of `IF NOT EXISTS` and `OR REPLACE` apply to both standard and comp The `IF NOT EXISTS` and `OR REPLACE` parts of these commands cannot be used together. ==== +[[composite-databases-default-language]] +=== Create composite databases with `DEFAULT LANGUAGE` +The `CREATE COMPOSITE DATABASE` command can be used to set the default Cypher version when creating a composite database. + +.Query +[source, cypher] +---- +CREATE COMPOSITE DATABASE inventory DEFAULT LANGUAGE CYPHER 5 +---- + +For more information see link:{neo4j-docs-base-uri}/cypher-manual/current/queries/select-version/#select-default-cypher-version[Cypher Manual -> Queries -> Select Cypher version]. + [[composite-databases-stop]] == Stop composite databases diff --git a/modules/ROOT/pages/database-administration/standard-databases/alter-databases.adoc b/modules/ROOT/pages/database-administration/standard-databases/alter-databases.adoc index 21e31bc55..8e3855c70 100644 --- a/modules/ROOT/pages/database-administration/standard-databases/alter-databases.adoc +++ b/modules/ROOT/pages/database-administration/standard-databases/alter-databases.adoc @@ -1,5 +1,4 @@ :description: how to modify standard databases in Neo4j using the Cypher command `ALTER DATABASE`. -[role=enterprise-edition not-on-aura] [[administration-databases-alter-database]] = Alter databases @@ -19,7 +18,8 @@ ALTER DATABASE name [IF EXISTS] { SET ACCESS {READ ONLY \| READ WRITE} \| SET TOPOLOGY n PRIMAR{Y\|IES} [m SECONDAR{Y\|IES}] \| -SET OPTION option value +SET OPTION option value \| +SET DEFAULT LANGUAGE CYPHER {5\|25} } [WAIT [n [SEC[OND[S]]]]\|NOWAIT] ---- @@ -37,6 +37,7 @@ There can be multiple `SET OPTION` or `REMOVE OPTION` clauses for different opti ==== |=== +[role=enterprise-edition not-on-aura] [[manage-databases-alter]] == Alter database access mode @@ -97,11 +98,17 @@ ALTER DATABASE nonExisting IF EXISTS SET ACCESS READ WRITE ---- +== Alter database default language +The `ALTER DATABASE` command can be used to set the default Cypher version for a database, including the `system` database. +For more information see link:{neo4j-docs-base-uri}/cypher-manual/current/queries/select-version/#alter-default-cypher-version[Cypher Manual -> Queries -> Select Cypher version]. + +[role=enterprise-edition not-on-aura] == Alter database topology In a cluster environment, you can use the `ALTER DATABASE` command to change the number of servers hosting a database. For more information, see xref::clustering/databases.adoc#alter-topology[Managing databases in a cluster]. +[role=enterprise-edition not-on-aura] [[alter-database-options]] == `ALTER DATABASE` options diff --git a/modules/ROOT/pages/database-administration/standard-databases/configuration-parameters.adoc b/modules/ROOT/pages/database-administration/standard-databases/configuration-parameters.adoc index 402bebffd..8117db141 100644 --- a/modules/ROOT/pages/database-administration/standard-databases/configuration-parameters.adoc +++ b/modules/ROOT/pages/database-administration/standard-databases/configuration-parameters.adoc @@ -93,6 +93,15 @@ Example configuration: ---- server.databases.writable=["foo", "bar"] ---- +| xref:configuration/configuration-settings.adoc#config_db.query.default_language[`db.query.default_language`] +a| +The default query language version used for newly created databases where not specified as part of `CREATE` or `ALTER` database. This will also be used for `system` and `neo4j` databases when a new DBMS is started. + +Example configuration: +[source, example, role="noheader"] +---- +db.query.default_language=CYPHER_5 +---- |=== [NOTE] diff --git a/modules/ROOT/pages/database-administration/standard-databases/create-databases.adoc b/modules/ROOT/pages/database-administration/standard-databases/create-databases.adoc index 23c20b13e..6498d3040 100644 --- a/modules/ROOT/pages/database-administration/standard-databases/create-databases.adoc +++ b/modules/ROOT/pages/database-administration/standard-databases/create-databases.adoc @@ -53,6 +53,7 @@ See xref:database-internals/store-formats.adoc[Store formats], for more details [source, syntax, role="noheader"] ---- CREATE DATABASE name [IF NOT EXISTS] +[DEFAULT LANGUAGE CYPHER {5\|25}] [TOPOLOGY n PRIMAR{Y\|IES} [m SECONDAR{Y\|IES}]] [OPTIONS "{" option: value[, ...] "}"] [WAIT [n [SEC[OND[S]]]]\|NOWAIT] @@ -61,6 +62,7 @@ CREATE DATABASE name [IF NOT EXISTS] [source, syntax, role="noheader"] ---- CREATE OR REPLACE DATABASE name +[DEFAULT LANGUAGE CYPHER {5\|25}] [TOPOLOGY n PRIMAR{Y\|IES} [m SECONDAR{Y\|IES}]] [OPTIONS "{" option: value[, ...] "}"] [WAIT [n [SEC[OND[S]]]]\|NOWAIT] @@ -80,6 +82,7 @@ CREATE OR REPLACE DATABASE name [source, syntax, role="noheader"] ---- CREATE DATABASE name [IF NOT EXISTS] +[[SET] DEFAULT LANGUAGE CYPHER {5\|25}] [[SET] TOPOLOGY n PRIMAR{Y\|IES} [m SECONDAR{Y\|IES}]] [OPTIONS "{" option: value[, ...] "}"] [WAIT [n [SEC[OND[S]]]]\|NOWAIT] @@ -88,6 +91,7 @@ CREATE DATABASE name [IF NOT EXISTS] [source, syntax, role="noheader"] ---- CREATE OR REPLACE DATABASE name +[[SET] DEFAULT LANGUAGE CYPHER {5\|25}] [[SET] TOPOLOGY n PRIMAR{Y\|IES} [m SECONDAR{Y\|IES}]] [OPTIONS "{" option: value[, ...] "}"] [WAIT [n [SEC[OND[S]]]]\|NOWAIT] @@ -363,6 +367,9 @@ The behavior of `IF NOT EXISTS` and `OR REPLACE` apply to both standard and comp The `IF NOT EXISTS` and `OR REPLACE` parts of these commands cannot be used together. ==== +==== Create databases with `DEFAULT LANGUAGE` +The `CREATE DATABASE` command can be used to set the default Cypher version when creating a database. +For more information see link:{neo4j-docs-base-uri}/cypher-manual/current/queries/select-version/#select-default-cypher-version[Cypher Manual -> Queries -> Select Cypher version]. [[manage-databases-start]] == Start databases diff --git a/modules/ROOT/pages/database-administration/standard-databases/listing-databases.adoc b/modules/ROOT/pages/database-administration/standard-databases/listing-databases.adoc index b55f58fe6..b21fd290a 100644 --- a/modules/ROOT/pages/database-administration/standard-databases/listing-databases.adoc +++ b/modules/ROOT/pages/database-administration/standard-databases/listing-databases.adoc @@ -193,6 +193,11 @@ For other database states the value will be `NULL`. |The names of any constituents the database may have. Applicable only for composite databases. label:default-output[] | LIST +|defaultLanguage +|The default query language for this database. +Queries that are not prefixed with a query language version will default to executing with this version of Cypher. +|STRING + |options |The map of options applied to the database. | MAP @@ -203,9 +208,11 @@ The results of the `SHOW DATABASES` command are filtered according to the `ACCES However, some privileges enable users to see additional databases regardless of their `ACCESS` privileges: * Users with `CREATE/DROP/ALTER DATABASE` or `SET DATABASE ACCESS` privileges can see all standard databases. -* Users with `CREATE/DROP COMPOSITE DATABASE` or `COMPOSITE DATABASE MANAGEMENT` privileges can see all composite databases. +* Users with `CREATE/DROP/ALTER COMPOSITE DATABASE` or `COMPOSITE DATABASE MANAGEMENT` privileges can see all composite databases. * Users with `DATABASE MANAGEMENT` privilege can see all databases. +The `SET DATABASE DEFAULT LANGUAGE` privilege is intentionally left out and does not affect the returned databases. + If a user has not been granted `ACCESS` privilege to any databases nor any of the above special cases, the command can still be executed but it will only return the `system` database, which is always visible. [[database-states]] @@ -308,11 +315,11 @@ SHOW DATABASE movies YIELD * .Result [role="queryresult"] ---- -+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| name | type | aliases | access | databaseID | serverID | address | role | writer | requestedStatus | currentStatus | statusMessage | default | home | currentPrimariesCount | currentSecondariesCount | requestedPrimariesCount | requestedSecondariesCount | creationTime | lastStartTime | lastStopTime | store | lastCommittedTxn | replicationLag | constituents | options | -+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| "movies" | "standard" | ["films", "motion pictures"] | "read-write" | "C066801F54B44EA1520F0FE392B4005AABF42D8DD0A5FD09969B955575D287D5" | "e3063985-e2f4-4728-824b-a7d53779667a" | "localhost:7687" | "primary" | TRUE | "online" | "online" | "" | FALSE | FALSE | 1 | 0 | 1 | 0 | 2023-08-14T10:01:29.074Z | 2023-08-14T10:01:29.074Z | NULL | "record-aligned-1.1" | 3 | 0 | [] | {} | -+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ ++----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| name | type | aliases | access | databaseID | serverID | address | role | writer | requestedStatus | currentStatus | statusMessage | default | home | currentPrimariesCount | currentSecondariesCount | requestedPrimariesCount | requestedSecondariesCount | creationTime | lastStartTime | lastStopTime | store | lastCommittedTxn | replicationLag | constituents | defaultLanguage | options | ++----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| "movies" | "standard" | ["films", "motion pictures"] | "read-write" | "C066801F54B44EA1520F0FE392B4005AABF42D8DD0A5FD09969B955575D287D5" | "e3063985-e2f4-4728-824b-a7d53779667a" | "localhost:7687" | "primary" | TRUE | "online" | "online" | "" | FALSE | FALSE | 1 | 0 | 1 | 0 | 2023-08-14T10:01:29.074Z | 2023-08-14T10:01:29.074Z | NULL | "record-aligned-1.1" | 3 | 0 | [] | "CYPHER 5" | {} | ++----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ ---- == Show the number of databases diff --git a/modules/ROOT/pages/database-administration/syntax.adoc b/modules/ROOT/pages/database-administration/syntax.adoc index 99fc4b4f4..21a889075 100644 --- a/modules/ROOT/pages/database-administration/syntax.adoc +++ b/modules/ROOT/pages/database-administration/syntax.adoc @@ -118,6 +118,7 @@ YIELD { * \| field[, ...] } [ORDER BY field[, ...]] [SKIP n] [LIMIT n] [source, syntax, role="noheader"] ---- CREATE DATABASE name [IF NOT EXISTS] +[DEFAULT LANGUAGE CYPHER {5\|25}] [TOPOLOGY n PRIMAR{Y\|IES} [m SECONDAR{Y\|IES}]] [OPTIONS "{" option: value[, ...] "}"] [WAIT [n [SEC[OND[S]]]]\|NOWAIT] @@ -126,6 +127,7 @@ CREATE DATABASE name [IF NOT EXISTS] [source, syntax, role="noheader"] ---- CREATE OR REPLACE DATABASE name +[DEFAULT LANGUAGE CYPHER {5\|25}] [TOPOLOGY n PRIMAR{Y\|IES} [m SECONDAR{Y\|IES}]] [OPTIONS "{" option: value[, ...] "}"] [WAIT [n [SEC[OND[S]]]]\|NOWAIT] @@ -145,6 +147,7 @@ CREATE OR REPLACE DATABASE name [source, syntax, role="noheader"] ---- CREATE DATABASE name [IF NOT EXISTS] +[[SET] DEFAULT LANGUAGE CYPHER {5\|25}] [[SET] TOPOLOGY n PRIMAR{Y\|IES} [m SECONDAR{Y\|IES}]] [OPTIONS "{" option: value[, ...] "}"] [WAIT [n [SEC[OND[S]]]]\|NOWAIT] @@ -153,6 +156,7 @@ CREATE DATABASE name [IF NOT EXISTS] [source, syntax, role="noheader"] ---- CREATE OR REPLACE DATABASE name +[[SET] DEFAULT LANGUAGE CYPHER {5\|25}] [[SET] TOPOLOGY n PRIMAR{Y\|IES} [m SECONDAR{Y\|IES}]] [OPTIONS "{" option: value[, ...] "}"] [WAIT [n [SEC[OND[S]]]]\|NOWAIT] @@ -161,8 +165,13 @@ CREATE OR REPLACE DATABASE name ====== ===== + === Create a composite database +[.tabbed-example] +===== +[role=include-with-Cypher-5] +====== [options="header", width="100%", cols="2m,4a"] |=== | Command | Syntax @@ -172,6 +181,7 @@ CREATE OR REPLACE DATABASE name [source, synatx, role="noheader"] ---- CREATE COMPOSITE DATABASE name [IF NOT EXISTS] +[DEFAULT LANGUAGE CYPHER {5\|25}] [OPTIONS "{" "}"] [WAIT [n [SEC[OND[S]]]]\|NOWAIT] ---- @@ -179,10 +189,39 @@ CREATE COMPOSITE DATABASE name [IF NOT EXISTS] [source, syntax, role="noheader"] ---- CREATE OR REPLACE COMPOSITE DATABASE name +[DEFAULT LANGUAGE CYPHER {5\|25}] [OPTIONS "{" "}"] [WAIT [n [SEC[OND[S]]]]\|NOWAIT] ---- |=== +====== + +[role=include-with-Cypher-25] +====== +[options="header", width="100%", cols="2m,4a"] +|=== +| Command | Syntax + +| CREATE COMPOSITE DATABASE +| +[source, synatx, role="noheader"] +---- +CREATE COMPOSITE DATABASE name [IF NOT EXISTS] +[[SET] DEFAULT LANGUAGE CYPHER {5\|25}] +[OPTIONS "{" "}"] +[WAIT [n [SEC[OND[S]]]]\|NOWAIT] +---- + +[source, syntax, role="noheader"] +---- +CREATE OR REPLACE COMPOSITE DATABASE name +[[SET] DEFAULT LANGUAGE CYPHER {5\|25}] +[OPTIONS "{" "}"] +[WAIT [n [SEC[OND[S]]]]\|NOWAIT] +---- +|=== +====== +===== === Alter a database @@ -198,7 +237,8 @@ ALTER DATABASE name [IF EXISTS] { SET ACCESS {READ ONLY \| READ WRITE} \| SET TOPOLOGY n PRIMAR{Y\|IES} [m SECONDAR{Y\|IES}] \| -SET OPTION option value +SET OPTION option value \| +SET DEFAULT LANGUAGE CYPHER {5\|25} } [WAIT [n [SEC[OND[S]]]]\|NOWAIT] ---- @@ -216,6 +256,22 @@ There can be multiple `SET OPTION` or `REMOVE OPTION` clauses for different opti ==== |=== +=== Alter a composite database + +[options="header", width="100%", cols="1m,5a"] +|=== +| Command | Syntax + +| ALTER DATABASE +| +[source, syntax, role="noheader"] +---- +ALTER DATABASE name [IF EXISTS] +SET DEFAULT LANGUAGE CYPHER {5\|25} +[WAIT [n [SEC[OND[S]]]]\|NOWAIT] +---- +|=== + === Stop a database [options="header", width="100%", cols="1m,5a"] @@ -319,6 +375,7 @@ CREATE OR REPLACE ALIAS name FOR DATABASE targetName CREATE ALIAS name [IF NOT EXISTS] FOR DATABASE targetName AT 'url' USER username PASSWORD 'password' [DRIVER "{" setting: value[, ...] "}"] +[DEFAULT LANGUAGE CYPHER {5\|25}] [PROPERTIES "{" key: value[, ...] "}"] ----- [source, syntax, role=noheader] @@ -326,6 +383,7 @@ AT 'url' USER username PASSWORD 'password' CREATE OR REPLACE ALIAS name FOR DATABASE targetName AT 'url' USER username PASSWORD 'password' [DRIVER "{" setting: value[, ...] "}"] +[DEFAULT LANGUAGE CYPHER {5\|25}] [PROPERTIES "{" key: value[, ...] "}"] ----- |=== @@ -360,6 +418,7 @@ ALTER ALIAS name [IF EXISTS] SET DATABASE [USER username] [PASSWORD 'password'] [DRIVER "{" setting: value[, ...] "}"] +[DEFAULT LANGUAGE CYPHER {5\|25}] [PROPERTIES "{" key: value[, ...] "}"] -----