Virtual layers: not working through QFieldCloud but ok otherwise. Any solution?

Hello everyone,
I’m trying to use a virtual layer for a QField project. It works perfectly in QGIS, and it seems to work as well when packaging the project for QField before importing it on the Android phone from local files. However, when using QFieldCloud, which I have to, the use of a virtual layer lead to an error so that the download is not possible. The error is wrong though: it says “(Downloading error. [QF/permission_denied_plan_inssufficient] Permission denied because the user acount’s plan is insufficient)”, while I can guarantee the available space is largely enough.
Has anyone an idea how to work, if possible, properly with virtual layers through QFieldCloud?
Thanks,
Jason


Imported from GitHub discussion by @jasoncl-5w on 2024-03-20T01:58:25Z

Same problem here with a virtual layer in a project for qfield cloud.

Anybody any idea how to solve this error?


Imported from GitHub comment by @elmonchas on 2025-03-31T18:46:32Z

jasoncl-5w , could you share a sample of your project that fails?


Imported from GitHub comment by @nirvn on 2025-04-01T01:44:23Z

nirvn Here are some pointers from my case. In the project overview on cloud it gives this warning:

When I check the log I see this:

When I re-open the project on qgis desktop. The virtual layer also have an unknown datasource

The option “no geometry” was selected. I als otried automatic handling, but same result.
This is the probably faulty query:

– Step 1: Create an aggregated table from invoer_2025
WITH nieuw_tabel AS (
SELECT
soortlijst2025_wet_naam AS wet_naam,
COUNT(distinct hok_id) AS N_hokken_nieuw
FROM invoer_snl_2025
GROUP BY soortlijst2025_wet_naam
),

– Step 2: Create an aggregated table from oude_stippen
oud_tabel AS (
SELECT
soort_wet AS wet_naam,
COUNT(distinct hok_id) AS N_hokken_oud
FROM oude_stippen_SNLonly
GROUP BY wet_naam
)

– Step 3: Join both aggregated tables on wet_naam
SELECT
subquery.wet_naam,
subquery.N_hokken_nieuw,
subquery.N_hokken_oud
FROM (
SELECT
COALESCE(n.wet_naam, o.wet_naam) AS wet_naam, – Keep non-matching values
COALESCE(n.N_hokken_nieuw, 0) AS N_hokken_nieuw, – Replace NULL with 0 for missing values in nieuw_tabel
COALESCE(o.N_hokken_oud, 0) AS N_hokken_oud – Replace NULL with 0 for missing values in oud_tabel
FROM nieuw_tabel n
FULL OUTER JOIN oud_tabel o ON n.wet_naam = o.wet_naam
) AS subquery;


Imported from GitHub comment by @elmonchas on 2025-04-01T06:42:38Z

elmonchas , please provide a test project


Imported from GitHub comment by @nirvn on 2025-04-01T06:44:06Z


Imported from GitHub comment by @elmonchas on 2025-04-01T06:48:56Z

sample project.zip


Imported from GitHub comment by @elmonchas on 2025-04-01T06:52:37Z

Hi elmonchas ,

After reviewing your project, I noticed that your project has virtual layers, which are currently not available in the Community plan of QFieldCloud. However, it is in our backlog, and we plan to make it available for all plans in the future.

In the meantime, the recommendation is to save these virtual layers that you created with SQL and save them as a GeoPackage.


Imported from GitHub comment by @SeqLaz on 2025-04-16T10:49:52Z

virtual layer support in all plans would be great! The issue with the virtual layer actually happens with a paid plan. This seemed to be the case for jasoncl-5w too.

Anyway this might be solved with the upcoming changes then


Imported from GitHub comment by @elmonchas on 2025-04-23T13:06:04Z