Okay
  Public Ticket #3025211
PostgreSQL
Closed

Comments

  •  1
    David Spitz started the conversation

    Do you support PostgreSQL? (Instead of MySQL)

  •  1,819
    Miloš replied

    Hi, David

    Firstly, I would like to sincerely apologize for the delayed response as we have been experiencing an unusually high number of tickets. I am sorry that it has taken longer than usual to respond to your concern and your patience is highly appreciated.

    -

    Yes, there are separate database connections for MySQL, MS SQL and PostgreSQL databases.

    Please check out this page that explains how to use this functionality.

    Let me know if you need any assistance. Thanks

    -

    Just wanted to point out that we have a sandbox/Demo site (https://sandbox.wpdatatables.com/), that you can use to try out some of the plugin's features;

    and there is a 15-day money-back guarantee period,
    so if you purchase the plugin, you can safely fully test it out,
    we will assist along the way,
    and if it doesn't fit your needs you can request and receive a refund in that period.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  •  1
    David Spitz replied

    I have another question. 

    Right now I am on MySQL. The issue I have is that MySQL does not support the MEDIAN function natively  — and everything I will be doing revolves around showing medians. 

    With Postgres I could do this but I’m reluctant to switch right now. 

    The alternative is to use subqueries and parameters in MySQL to get to the median. Something like this:

    SELECT AVG(dd.val) as median_val
    FROM (
    SELECT d.val, @rownum:=@rownum+1 as `row_number`, @total_rows:=@rownum  FROM data d, (SELECT @rownum:=0) r  WHERE d.val is NOT NULL  -- put some where clause here  ORDER BY d.val
    ) as dd
    WHERE dd.row_number IN ( FLOOR((@total_rows+1)/2), FLOOR((@total_rows+2)/2) );

    All works fine. However, with this kind of implementation I lose the simplicity of putting my answers in a simple VIEW table to send to you. 

    Here’s are my questions:

    - can you support having this more complicated query to generate charts (I wouldn’t be able to give you a simple table)?

    - with this kind of approach, will you also enable me to put filters on my charts as your team so eloquently described in a recent tutorial?

  •  1,819
    Miloš replied

    Hi, David

    For this, i have to double-check with my senior colleagues at the 2nd level Team, in order to give you most accurate information.

    As soon as they confirm it for me, I will come back to you straight away. Thank you for your patience.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  •  1
    David Spitz replied

    another request: in one of your video tutorials on the subject of deploying user controlled filters on charts, you mentioned that while one needs to show the table alongside the chart, that there is a “hack” to hide the table from view if that is what is preferred. And that if we are interested we should follow up with support to find out how. 

    We are interested. Please let me know how this is done. 

  •  1,819
    Miloš replied

    Hi, David

    Apologies about the delay, we had a small break to celebrate Orthodox Easter, so it has slowed down our work pace.

    -

    I'm searching to find the best advise for you - one of the possibilities i am considering is that you could try to avoid subqueries by splitting them into separate Views, and then merging them into one View, or combining selection of multiple Views, in order to get a "simpler SELECT" statement for our plugin and to ensure working filters.

    I am still going to double-check that and the previous points that we talked about, regarding advice on  creating more complex SQL queries, based on the example you have sent us - i will get additional help from developers to be sure.

    - They will be back in the office tomorrow, so i will do my best to confirm as quickly as possible, and I'll get back to you on that.

    -

    In the meantime, i can give you some useful information about our PHP & SQL parser:

    In some situations, using certain functions within SQL, the wpDataTables server has problems with parsing the query and building new queries dynamically (rarely happens, but does sometimes).

    Our logic is based on a PHP SQL parser which has full support for the SQL dialect for the following statement types:

    1.    SELECT, INSERT, UPDATE, DELETE, REPLACE, RENAME, SHOW, SET, DROP, CREATE INDEX, CREATE TABLE, EXPLAIN and DESCRIBE.
    Some of them like DROP and DELETE, though, are disabled for security reasons.

    2.   Using variables ( @ ), stored procedures and nested queries is not supported, but you can prepare a MySQL view (which will return the data you need); call it “view1” for example, and then build a wpDataTable based on a simple query like “SELECT * FROM view1”.

    3.    For MySQL engine we are dynamically adding the accent grave ( ` ), so there’s no need to use it around the table name in the query.

    -

    Regarding chart filtering, as you probably saw, i guess you watched this video;

    if you switch on "follow table filtering", and you set both the table and chart on same page, it should work.

    -

    We can help you hide the table, but have filters show, and the chart on the page, with some custom CSS:

    You would first need to disable the following in table settings:

    "Show X entries" drop-down; "Info Block" from Display tab:

    7731879016.png

    Then enable main "search block" and "Show filters in a form above Table" from the Sorting and Filtering tab:

    7490859486.png

    Then, you can hide the table, leaving only the filters and the chart visibe like this,

    insert this custom CSS in the Customize tab of the table settings:

    .wpdt-c .wpDataTablesWrapper table {
    display: none !important;
    }
    
    7638678443.png

    And here is an example, a page with a table and a chart, with filtering above the table(without hiding):

    7732210001.png

    Now when we add the CSS, the table is hidden, but you can still filter the chart:

    7049364031.png

    This is how you'd create a page where you'd have Chart #1 dependent on wpDataTable #1 so it follows filtering, and the table hidden using CSS.

    -

    Let me know if anything was not clear regarding hiding the table;

    and for the other points i will still confirm them for you, regarding MySQL queries. Thanks.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  •   David Spitz replied privately
  •  1
    David Spitz replied

    continuing this discussion… and focusing on the need for subqueries…

    You will see that my query has two subqueries. 

    There is no doubt that I can create a View table to accomplish the inner most query. So that piece should work. 

    The query in the middle does the interesting work of performing a window function AVG on the view table that I would create. I’m guessing that piece could be handled by your solution. 

    The outer-most query is very simple but very important. It says — only show the value (for the result of the window function) if the N (the number of entities) for that group is over a certain preset number (the minimum aggregation — currently a parameter, but I could “hardwire” that number too). 

    I don’t think we can use a view table on the middle query. 

  •  1
    David Spitz replied

    Ok...  You were right!  I can just create multiple VIEW tables to do the nesting... So this does seem to work.  Thank you for the guidance!

    I still do need to figure out how I can make the filtering (user controlled) work within this but I'm encouraged. 

    And I'm assuming all of this will translate over to PostgreSQL  (any difference in what you support for Postgres vs. mysql?  Again -- I need median window functions, so it's important for my application).

  •  1
    David Spitz replied

    making good progress now. But I did have one question. Using Highcharts for bar graphs, I would prefer to have a label at the end of each bar, saying what the value is ( instead of relying on the tooltip to show the value).  Is this possible?  I couldn’t find a way to do it. 

  •  1
    David Spitz replied

    we figured out the javascript angle here. 

    https://wpdatatables.com/faqmd/remove-datalabels-add-legend-pie-charthighcharts/


    i assume this is the only way to make the change in Highcharts bar graphs to show data labels without tooltips?

  •  1,819
    Miloš replied


    Hey, David

    Sorry about the delayed response againsmile.png

    Thank you for your patience and cooperation on all the points.

    I am happy to see that you have advanced towards the full solution, and fingers crossed that you get all the remaining bits and pieces of the puzzle, of course.

    -

    Regarding everything translating over to PostgreSQL as the same as MySQL, to be honest, i can't confirm it with 100 % accuracy, but it should work.

    -

    Regarding the charts angle, i checked that with our senior 2nd level Team, and unfortunately, we don't have a working example for what you described as in a label at the end of each bar, saying what the value is ( instead of relying on the tooltip to show the value).

    We haven't had the chance to test something like that yet.

    But i can see that you've figured out the Highcharts example, so basically, using the same methodology, you should be able to manipulate and customize more functionalities/details of the chart engine behaviour.

    -

    That is the default behavior of the charts engine, but if you need some custom solution you can check our documentation about wpDataCharts callbacks

    • Every chart exposes several options that customize its look and feel. Charts usually support custom options appropriate to that visualization. wpDataChart callbacks allow adding options that are available in Google Charts APIHighcharts API, and Chart.js API
    • All necessary resources are available in charts engines API (depends on which one you use). Every engine has a different approach to chart settings. In wpDataChart callbacks, you have to adopt those settings to the wpDataChart object (you can take a look at examples for each engine in our documentation, and also in the Support help center). A huge number of examples for any area of programming can be found on stackoverflow.com (typing your problem in google and at the end add "site: stackoverflow.com" and Google will search only that website). Also, a lot of examples of charts, chart settings, and customization can be found on jsffidle.net (typing in google for example "line chart highcharts jsffidle")

    Please note that using hooks or wpDataTable and wpDataChart callbacks requires a certain level of programming skills and included support refers only to advice.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  •  1
    David Spitz replied

    thank you Milos. 


    i am starting to use filters to display my charts. 

    In one of your videos they described the fact that while we need to have the whole corresponding table from which the chart is drawn to be displayed on the same page as the chart in order for the filter to be displayed and to work… that we could reach out to support and open up a ticket to allow us to remove the table from view and just leave the filters. 

    Can we please do that on my account?  

  •  1
    David Spitz replied

    here is another important point:

    My understanding is that the engine you use in your query to create the tables available for charting  is MySQL. 

    For me, it is important to be able to use a window function in that last step, calculating “median” - something that MySQL does not support. 

    Would it be possible with some customization to allow another engine (namely PostgreSQL) to perform the query and return the result to the rest of your solution?

    I’m speaking with the outside consultants based in Poland  recommended on your site next week. Maybe they can help?  But I’d like to know if this is technically even possible. 

  •  1
    David Spitz replied

    I’m wondering… we have a calculation that requires the use of a median window function. Is there any way that the query window that you provide can be modified so that it accepts PostgreSQL (instead of MySQL)?

  •  1,819
    Miloš replied

    Hi, David

    Sorry for so much waiting time on the response.

    -

    I am not sure, to be honest, i haven't personally had experience with the "median" functionality yet;

    but i will certainly escalate this, and i will get confirmation if what you described can be done with our plugin.

    -

    Regarding hiding the table when it is on the same page as the chart, to have that filtering capability but hide the table, i can give you some custom CSS;

    We can hide the table using CSS, leaving only the chart and the filters. 

    Since you need to show the filters, a simple CSS like this would not be useful, because it'd hide the filters too:

    .wpdt-c .wpDataTables.wpDataTablesWrapper {
    display: none !important;
    }
    

    So, instead, we would first need to disable the following in table settings:

    "Show X entries" drop-down; "Info Block" from Display tab:

    5739555450.png


    Then, "Enable main search block"  and "show filters in a form above the table" from the Sorting and Filtering tab:

    7822122957.png


    Then, you can hide the table, leaving the filters above the chart like this:

    <style>
    .wpdt-c .wpDataTablesWrapper table {
    display: none !important;
    }
    </style>
    [wpdatatable id=1]
    [wpdatachart id=1]
    

    This is how you'd create a page where you'd have Chart #1 dependent on wpDataTable #1 so it follows filtering, and the table hidden using CSS.

    -

    Let me know how that goes, and of course, i will still get back to you about the other point in question.

    Thank you

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  •  1,819
    Miloš replied

    Hi, David

    My sincerest apologies for all the delay that happened for confirming about functionality of medians.

    The developers have confirmed that, unfortunately at this moment, our SQL & PHP Parser does not support use for medians.

    But please feel free to search on our suggestions page

     to see if someone may be already suggested this feature. If you can't see it, feel free to add your suggestion there,  and as more people vote, the feature will move higher on the priority list.

    You can certainly follow our changeLog page if you'd like ( it is also available in the plugin dashboard), where we state any changes/new features/bug fixes during updates;

    and our newsletter, so you're informed about new features, bug fixes, freebies, etc.

    Once more, apologies for all the time passed. Thank you very much for all your patience.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables