Skip to content

Commit 6a4d663

Browse files
Hunternessrenetapopova
authored andcommitted
Add info about default language clauses for aliases
1 parent 61614d5 commit 6a4d663

File tree

3 files changed

+69
-19
lines changed

3 files changed

+69
-19
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
@@ -154,14 +154,14 @@ SHOW ALIASES FOR DATABASE YIELD *
154154
.Result
155155
[role="queryresult"]
156156
----
157-
+-----------------------------------------------------------------------------------------------------------------------------------+
158-
| name | composite | database | location | url | user | driver | properties |
159-
+-----------------------------------------------------------------------------------------------------------------------------------+
160-
| "garden.flowers" | "garden" | "perennial-flowers" | "local" | NULL | NULL | NULL | {perennial: TRUE} |
161-
| "garden.trees" | "garden" | "updatedtrees" | "remote" | "neo4j+s://location:7687" | "alice" | {} | {treeversion: 2} |
162-
| "library.romance" | "library" | "romance-books" | "remote" | "neo4j+s://location:7687" | "alice" | {} | {} |
163-
| "library.sci-fi" | "library" | "sci-fi-books" | "local" | NULL | NULL | NULL | {} |
164-
+-----------------------------------------------------------------------------------------------------------------------------------+
157+
+-----------------------------------------------------------------------------------------------------------------------------------------------------+
158+
| name | composite | database | location | url | user | driver | defaultLanguage | properties |
159+
+-----------------------------------------------------------------------------------------------------------------------------------------------------+
160+
| "garden.flowers" | "garden" | "perennial-flowers" | "local" | NULL | NULL | NULL | NULL | {perennial: TRUE} |
161+
| "garden.trees" | "garden" | "updatedtrees" | "remote" | "neo4j+s://location:7687" | "alice" | {} | NULL | {treeversion: 2} |
162+
| "library.romance" | "library" | "romance-books" | "remote" | "neo4j+s://location:7687" | "alice" | {} | NULL | {} |
163+
| "library.sci-fi" | "library" | "sci-fi-books" | "local" | NULL | NULL | NULL | NULL | {} |
164+
+-----------------------------------------------------------------------------------------------------------------------------------------------------+
165165
----
166166

167167
[[delete-composite-database-alias]]

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

Lines changed: 58 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ DRIVER {
5353
connection_pool_idle_test: duration({minutes: 2}),
5454
connection_pool_max_size: 10,
5555
logging_level: 'info'
56-
};
56+
}
57+
DEFAULT LANGUAGE CYPHER 25;
5758
----
5859
////
5960

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

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

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

361367
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.
362-
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.
363-
There is currently no command to set it explicitly nor change it on existing remote database aliases.
368+
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`].
364369

365370
As with local database aliases, creating remote database aliases allows `IF NOT EXISTS` and `OR REPLACE` clauses.
366371
Both check for any remote or local database aliases.
@@ -445,6 +450,37 @@ SHOW ALIAS `remote-with-driver-settings` FOR DATABASE YIELD *
445450
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
446451
----
447452

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

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

@@ -482,7 +518,7 @@ SHOW ALIAS `remote-northwind-2021` FOR DATABASE YIELD name, properties
482518
== Alter database aliases
483519

484520

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

@@ -566,6 +602,17 @@ ALTER ALIAS `movie scripts` SET DATABASE
566602
DRIVER {}
567603
----
568604

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

571618
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)