Tables fail to read after their files were moved#
Symptoms#
The files of a File or Excel connection were moved to another folder or share, for example from E:\data
to \\files\data, and the connection was changed to the new location. Tables imported before the move
fail to read:
A File table keeps reading the old file and fails once that file is gone.
An Excel worksheet fails at once, even while the old workbook still exists, with an error such as:
The path 'E:\data\book.xlsx' resolves outside the permitted root directory and was rejected.
Importing the tables again lists them as unchanged and does not help.
Cause#
When Querona imports a file as a table, the table stores the absolute path of that file: the file itself for a File connection, the workbook for each worksheet of an Excel connection. Every read of the table opens that stored path, and an Excel table must also find it under the connection’s location. Editing the connection’s location does not, by itself, change the paths the tables store, and importing again leaves a table whose columns did not change as it is.
Querona now refuses a change of a connection’s locations that would leave imported tables reading files outside the connection’s locations, and offers to move the tables instead. A location changed before this check existed may have left tables reading the old paths.
Resolution#
To avoid the problem, change the location so that the tables move with it:
In the Admin Portal, edit the connection and change its location. When the save would leave tables outside the connection’s locations, a dialog asks where each group of tables moves; confirm it, and the connection and the tables are saved together.
In SQL, for a File connection, run
ALTER EXTERNAL DATA SOURCE <name> SET LOCATION = '<new location>'. It replaces the first location and moves the tables that read under it.
When the location was already changed and the tables still read the old paths, the commands above do nothing for them: they move only tables that read under a location the change removes. Instead:
Bring the old location back: add it to the list of a File connection, or set it back on an Excel connection. The save is accepted, because the tables read under it.
Remove it again, or set the new location again on an Excel connection. The dialog now asks where the tables move, and the save moves them.
For a File connection, Repair on the connection’s Source URIs blade moves the tables you have access to without these two steps.
The full procedure, including what is refused and the warnings the save reports, is in Moving a File or Excel connection to a new location.