Skip to content

Commit d86efda

Browse files
committed
Add info about default language clauses for aliases
1 parent 9372ad9 commit d86efda

File tree

3 files changed

+70
-20
lines changed

3 files changed

+70
-20
lines changed

modules/ROOT/pages/database-administration/aliases/manage-aliases-composite-databases.adoc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,14 @@ SHOW ALIASES FOR DATABASE YIELD *
153153
.Result
154154
[role="queryresult"]
155155
----
156-
+-----------------------------------------------------------------------------------------------------------------------------------+
157-
| name | composite | database | location | url | user | driver | properties |
158-
+-----------------------------------------------------------------------------------------------------------------------------------+
159-
| "garden.flowers" | "garden" | "perennial-flowers" | "local" | NULL | NULL | NULL | {perennial: TRUE} |
160-
| "garden.trees" | "garden" | "updatedtrees" | "remote" | "neo4j+s://location:7687" | "alice" | {} | {treeversion: 2} |
161-
| "library.romance" | "library" | "romance-books" | "remote" | "neo4j+s://location:7687" | "alice" | {} | {} |
162-
| "library.sci-fi" | "library" | "sci-fi-books" | "local" | NULL | NULL | NULL | {} |
163-
+-----------------------------------------------------------------------------------------------------------------------------------+
156+
+-----------------------------------------------------------------------------------------------------------------------------------------------------+
157+
| name | composite | database | location | url | user | driver | defaultLanguage | properties |
158+
+-----------------------------------------------------------------------------------------------------------------------------------------------------+
159+
| "garden.flowers" | "garden" | "perennial-flowers" | "local" | NULL | NULL | NULL | NULL | {perennial: TRUE} |
160+
| "garden.trees" | "garden" | "updatedtrees" | "remote" | "neo4j+s://location:7687" | "alice" | {} | NULL | {treeversion: 2} |
161+
| "library.romance" | "library" | "romance-books" | "remote" | "neo4j+s://location:7687" | "alice" | {} | NULL | {} |
162+
| "library.sci-fi" | "library" | "sci-fi-books" | "local" | NULL | NULL | NULL | NULL | {} |
163+
+-----------------------------------------------------------------------------------------------------------------------------------------------------+
164164
----
165165

166166
[[delete-composite-database-alias]]

modules/ROOT/pages/database-administration/aliases/manage-aliases-standard-databases.adoc

Lines changed: 59 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ DRIVER {
5252
connection_pool_idle_test: duration({minutes: 2}),
5353
connection_pool_max_size: 10,
5454
logging_level: 'info'
55-
};
55+
}
56+
DEFAULT LANGUAGE CYPHER 25;
5657
----
5758
////
5859

@@ -105,6 +106,11 @@ The driver options for connection to the remote database or `null` if the target
105106
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.
106107
| MAP
107108

109+
| defaultLanguage
110+
|
111+
The default language for non-constituent remote database aliases or `null` if it is a constituent or local database alias.
112+
| STRING
113+
108114
| properties
109115
| Any properties set on the database alias.
110116
| MAP
@@ -168,13 +174,13 @@ SHOW ALIASES FOR DATABASE YIELD *
168174
.Result
169175
[role="queryresult"]
170176
----
171-
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
172-
| name | composite | database | location | url | user | driver | properties |
173-
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
174-
| "films" | NULL | "movies" | "local" | NULL | NULL | NULL | {} |
175-
| "motion pictures" | NULL | "movies" | "local" | NULL | NULL | NULL | {namecontainsspace: TRUE} |
176-
| "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} | {} |
177-
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
177+
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
178+
| name | composite | database | location | url | user | driver | defaultLanguage | properties |
179+
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
180+
| "films" | NULL | "movies" | "local" | NULL | NULL | NULL | NULL | {} |
181+
| "motion pictures" | NULL | "movies" | "local" | NULL | NULL | NULL | NULL | {namecontainsspace: TRUE} |
182+
| "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" | {} |
183+
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
178184
----
179185

180186
=== Show `count` of aliases for a database
@@ -358,8 +364,7 @@ A database alias can target a remote database by providing an URL and the creden
358364
See xref:database-administration/aliases/remote-database-alias-configuration.adoc[] for the necessary configurations.
359365

360366
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.
361-
Instead, remote database aliases are assigned the default language given by xref:configuration/configuration-settings.adoc#config_db.query.default_language[`db.query.default_language`] on creation.
362-
There is currently no command to set it explicitly nor change it on existing remote database aliases.
367+
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`].
363368

364369
As with local database aliases, creating remote database aliases allows `IF NOT EXISTS` and `OR REPLACE` clauses.
365370
Both check for any remote or local database aliases.
@@ -409,7 +414,7 @@ This will be validated when the command is executed.
409414
* 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].
410415
* logging_level (For details, see xref:configuration/configuration-settings.adoc#config_dbms.routing.driver.logging.level[dbms.routing.driver.logging.level])
411416

412-
The driver settings are set in the `DRIVER` clause of the `CREATE ALIAS` or `ALTER ALIAS commands.
417+
The driver settings are set in the `DRIVER` clause of the `CREATE ALIAS` or `ALTER ALIAS` commands.
413418
For example, the following query creates a remote database alias using driver settings `connection_timeout` and
414419
`connection_pool_max_size` for connecting to the remote database `northwind-graph-2020:
415420

@@ -444,6 +449,37 @@ SHOW ALIAS `remote-with-driver-settings` FOR DATABASE YIELD *
444449
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
445450
----
446451

452+
==== Set default language for remote database aliases
453+
The default language for the remote database alias can be set using the `DEFAULT LANGUAGE` clause of `CREATE ALIAS` and `ALTER ALIAS` commands.
454+
For example, the following query creates a remote database alias with the default language `CYPHER 25`:
455+
456+
.Query
457+
[source, cypher]
458+
----
459+
CREATE ALIAS `remote-with-default-language` FOR DATABASE `northwind-graph-2020`
460+
AT "neo4j+s://location:7687"
461+
USER alice
462+
PASSWORD 'example_secret'
463+
DEFAULT LANGUAGE CYPHER 25
464+
----
465+
466+
When a database alias targeting a remote database has been created, its details can be shown with the `SHOW ALIASES FOR DATABASE` command.
467+
468+
.Query
469+
[source, cypher]
470+
----
471+
SHOW ALIAS `remote-with-default-language` FOR DATABASE YIELD name, defaultLanguage
472+
----
473+
474+
.Result
475+
[role="queryresult"]
476+
----
477+
+--------------------------------------------------+
478+
| name | defaultLanguage |
479+
+--------------------------------------------------+
480+
| "remote-with-default-language" | "CYPHER 25" |
481+
+--------------------------------------------------+
482+
----
447483

448484
==== Set properties for remote database aliases
449485

@@ -481,7 +517,7 @@ SHOW ALIAS `remote-northwind-2021` FOR DATABASE YIELD name, properties
481517
== Alter database aliases
482518

483519

484-
Database aliases can be altered using `ALTER ALIAS` to change its database target, properties, URL, user credentials, or driver settings.
520+
Database aliases can be altered using `ALTER ALIAS` to change its database target, properties, URL, user credentials, default language, or driver settings.
485521
The required privileges are described in the xref:authentication-authorization/dbms-administration.adoc#access-control-dbms-administration-alias-management[The DBMS ALIAS MANAGEMENT privileges].
486522
Only the clauses used will be altered.
487523

@@ -565,6 +601,17 @@ ALTER ALIAS `movie scripts` SET DATABASE
565601
DRIVER {}
566602
----
567603

604+
=== Alter default language for remote database aliases
605+
606+
Example of altering a remote database alias default language.
607+
608+
.Query
609+
[source, cypher]
610+
----
611+
ALTER ALIAS `remote-with-default-language` SET DATABASE
612+
DEFAULT LANGUAGE CYPHER 5
613+
----
614+
568615
=== Alter properties for local and remote database aliases
569616

570617
Examples of altering local and remote database alias properties.

modules/ROOT/pages/database-administration/syntax.adoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,13 +321,15 @@ CREATE OR REPLACE ALIAS name FOR DATABASE targetName
321321
CREATE ALIAS name [IF NOT EXISTS] FOR DATABASE targetName
322322
AT 'url' USER username PASSWORD 'password'
323323
[DRIVER "{" setting: value[, ...] "}"]
324+
[DEFAULT LANGUAGE CYPHER {5\|25}]
324325
[PROPERTIES "{" key: value[, ...] "}"]
325326
-----
326327
[source, syntax, role=noheader]
327328
-----
328329
CREATE OR REPLACE ALIAS name FOR DATABASE targetName
329330
AT 'url' USER username PASSWORD 'password'
330331
[DRIVER "{" setting: value[, ...] "}"]
332+
[DEFAULT LANGUAGE CYPHER {5\|25}]
331333
[PROPERTIES "{" key: value[, ...] "}"]
332334
-----
333335
|===
@@ -362,6 +364,7 @@ ALTER ALIAS name [IF EXISTS] SET DATABASE
362364
[USER username]
363365
[PASSWORD 'password']
364366
[DRIVER "{" setting: value[, ...] "}"]
367+
[DEFAULT LANGUAGE CYPHER {5\|25}]
365368
[PROPERTIES "{" key: value[, ...] "}"]
366369
-----
367370

0 commit comments

Comments
 (0)