Would something like USE federatednotions.gdpr CREATE CONSTRAINT ... work? The constraints need to be added to all the individual parts instead of the composite database linking them together
You should be able to use the database’s alias too (federatednotions.gdpr). Your screenshot shows the prompt was the composite database when you tried to create the constraint. As you stated, you needed to switch to the actual database in order to execute these type of commands.
I would use the USE clause to switch the database manually when needed. The drop down seems to just be a convenience which does the same. It does it in a new editor, so you need to ensure you move to that editor before executing your commands. I feel this makes it a more error prone approach.
No, that doesn't work.
I don't want to connect different DB together, but I'd like to be able to work in a federatedDB context being able to switch to each context and work on it.
If I am in a federated DB, the ':use' command not always works:
if I doesn't include a return it gives an error (i.e. doesn't switch the database)
if I add a return statement it returns nothing.
Finally, I would affirm that: 1) the composite database alias cannot be selected in the dropdown box; 2) The composite database alias cannot be queried in the browser
If a use a python script, can I solve or bypass these errors?
Try removing the ; after the use clause, in Cypher it isn't its own query but parts of a bigger one which is why you get an error when it's the only thing in your query
USE federatednotations.gdpr
CREATE CONSTRAINT ...
From my last reply:
Would something like USE federatednotions.gdpr CREATE CONSTRAINT ... work? The constraints need to be added to all the individual parts instead of the composite database linking them together
Notice how there isn't a ; between the USE and CREATE CONSTRAINT parts but you have one in your screenshot?
You seem to mix/confuse the browser command :use and the Cypher query clause USE, which are not interchangeable.
The :use is the same as using the drop down menu and is executed in browser to switch what database you are connected to. This can not be combined with a Cypher query, it is its own command.
In difference, the USE in Cypher is part of a query which tells the server to re-route this query from the database you are connected to and over to the requested database. This means it cannot be used on its own and need an actual query to follow it (not separated by ; as that separates different queries to be run after each other).
As for your conclusions, you are right that you can't connect directly to the composite database alias by either the drop down menu or the :use command. This is due to them only being available for querying when connected to the composite database they belong to. However, they can be queried when using the USE clause as part of the query itself, as this is how it was designed to be reached.
In the query, I tried different solutions looking for the one able to run;
But you're right, this solution works: now I'll embed in a most complex query and let you know if I still have problems.