I'm trying to create a table that points to an external postgres database.
I can run the query fine in the preview window, but when clicking the "create the table" button I get the error "info: WITH not implemented" at the top right of the screen (see screenshot).
Can you please advise how I can work around this?
For reference, here's the query that's being run:
" with
delegates as ( select stake_address, pool_address, stake_address_id from ( select row_number() over(PARTITION BY d.addr_id order by d.addr_id, d.id desc) row_number, sa."view" stake_address, ph."view" pool_address, d.addr_id stake_address_id from delegation d join pool_hash ph on ph.id = d.pool_hash_id join stake_address sa on sa.id = d.addr_id join delegation alldelegations on alldelegations.addr_id=d.addr_id where ph.view='pool1rtj8f2pjedcjh78ey2fc4wvatjyeudeam6lsv6snttwuvhn2vsq' ) inner_query where row_number=1 and pool_address='pool1rtj8f2pjedcjh78ey2fc4wvatjyeudeam6lsv6snttwuvhn2vsq' ), delegator_addresses as ( select row_number() over(PARTITION BY txo.stake_address_id order by txo.stake_address_id, txo.tx_id desc) row_number, encode(tx.hash, 'hex') tx_hash_view, stake_address, txo.address , pool_address, txo.stake_address_id, txo.value from delegates join tx_out txo on txo.stake_address_id = delegates.stake_address_id join tx on tx.id =txo.tx_id ) select *, (select sum(value) from utxo_view uv where uv.stake_address_id = delegator_addresses.stake_address_id) from delegator_addresses where row_number = 1
If your MySQL-query based wpDataTable doesn’t work correctly with server-side processing, probably this is happening because wpDataTables server has problems with parsing of the query and building new queries dynamically (rarely happens, but does sometimes). To avoid this please prepare a MySQL view (a stored query), which will return the data that you need, call it e.g. “view1” and then build a wpDataTabled based on a simple query like “SELECT * FROM view1″.
Please note some this when working with the server-side processing feature:
Please do not use “LIMIT” in the SELECT statement. wpDataTables adds it automatically and it will be overridden.
Please do not use “ORDER BY” in the SELECT statement. wpDataTables has its own sorting engine so it makes no sense to use MySQL’s sorting, since it will be overridden. Also, server-side processing feature adds this part of statement automatically when users trigger the sorting on the front-end, and having it in initial statement may cause the table to crash.
I'm trying to create a table that points to an external postgres database.
I can run the query fine in the preview window, but when clicking the "create the table" button I get the error "info: WITH not implemented" at the top right of the screen (see screenshot).
Can you please advise how I can work around this?
For reference, here's the query that's being run:
"
with
delegates as (
select stake_address, pool_address, stake_address_id from (
select row_number() over(PARTITION BY d.addr_id order by d.addr_id, d.id desc) row_number, sa."view" stake_address, ph."view" pool_address, d.addr_id stake_address_id
from delegation d
join pool_hash ph on ph.id = d.pool_hash_id
join stake_address sa on sa.id = d.addr_id
join delegation alldelegations on alldelegations.addr_id=d.addr_id
where
ph.view='pool1rtj8f2pjedcjh78ey2fc4wvatjyeudeam6lsv6snttwuvhn2vsq'
) inner_query
where row_number=1 and pool_address='pool1rtj8f2pjedcjh78ey2fc4wvatjyeudeam6lsv6snttwuvhn2vsq'
),
delegator_addresses as (
select row_number() over(PARTITION BY txo.stake_address_id order by txo.stake_address_id, txo.tx_id desc) row_number, encode(tx.hash, 'hex') tx_hash_view, stake_address, txo.address , pool_address, txo.stake_address_id, txo.value from delegates
join tx_out txo on txo.stake_address_id = delegates.stake_address_id
join tx on tx.id =txo.tx_id
)
select *, (select sum(value) from utxo_view uv where uv.stake_address_id = delegator_addresses.stake_address_id) from delegator_addresses where row_number = 1
"
Hi Rob
Thank you for reaching out to us.
If your MySQL-query based wpDataTable doesn’t work correctly with server-side processing, probably this is happening because wpDataTables server has problems with parsing of the query and building new queries dynamically (rarely happens, but does sometimes). To avoid this please prepare a MySQL view (a stored query), which will return the data that you need, call it e.g. “view1” and then build a wpDataTabled based on a simple query like “SELECT * FROM view1″.
Please note some this when working with the server-side processing feature: