Dear visitor, despite all the challenges, our team continues operating at full speed.

We are ready to help with any questions you may have. Please fill out this quick form and we'll get back to you.

Fill the form
Get Free Trial

PostgreSQL Pivot tables

Answered
Elia asked 7 days ago

Hi,
I’m brand new to Flexmonster,
Anybody can share a working code for retrieving a PostgreSQL query, and passing it to a felxmonster web app?
I couldn’t find any specific example in the documentation, they’re all specific to OLAP cases.
Thanks!

5 answers

Public
Milena Pechura Milena Pechura Flexmonster 7 days ago

Hi, Elia!
 
Thank you for writing to us.
 
Our team would like to recommend connecting to a PostgreSQL database using Flexmonster Data Server.
Please have a look at the tutorial. The 6th step shows the retrieving query sample.
 
If you would like to implement your own server, we kindly suggest using custom data source API – our custom communication protocol.

Please let us know if it works for you and in case any further questions arise.
 
Best regards,
Milena

Public
Elia 7 days ago

Hi Milena, 
thank you so much for the quick reply.
The Flexmonster Data Server is actually perfect for our requirements, and I can easily make it work on localhost.
But, I don’t know how to make it work on a cloud runtime (my app is run on Heroku) 
Any suggestion?
thanks!

Public
Milena Pechura Milena Pechura Flexmonster 6 days ago

Hello, Elia,
 
We would like to suggest deploying Flexmonster Data Server to the cloud application platforms that support executable files (for example, AWS EC2) or to Heroku by using Docker.
 
Another option is embedding Flexmonster Data Server dll in your app and deploying as one project.
Please note that it is possible if the application is using .NET Core.
 
Please let us know if it works for you.
 
Regards,
Milena

Public
Elia 2 days ago

HI Milena,
Thank you so much for the support, it’s almost solved.
I’ve succesfully deployed Flexmonster Data Server to an EC2 instance (following this tutorial)
It works great when I call the endpoint from http (HTTP). But, my web app redirects all requests to HTTPS, and that’s when the Data Server fails.
I just need to enable HTTPS (please note that my EC2 instance already allows all https requests)
Following this article, I’ve tried different settings in my flexmonster-config.json file, but none seem to work. For example:

{
    "DataSources": [{
        "Type": "database",
        "DatabaseType": "postgresql",
        "ConnectionString": "xxxx",
        "Indexes": "SELECT * FROM xxxx",
    }],
    "Security":
    {
        "Authorization":
        {
            "Enabled": false
        },
        "CORS":
        {
            "AllowOrigin": "*"
        },
    },
    "DataStorageOptions":
    {
        "DataRefreshTime": "60"
    },
    "Port": "9500",
    "HTTPS": "true"
}

I’ve tried to move “HTTPS”:”true” in and out the security element, type it as “HTTPS”:true, HTTPS=true etc, with no result.
In my template, I’m calling my EC2 endpoint as following

var pivot = new Flexmonster({
container: “output”,
componentFolder: “{% static ‘flexmonster/node_modules/flexmonster/’ %}”,
toolbar: true,
report: {
dataSource: {
type: “api”,
url: “https://ec2-xxxxx.xxxx.amazonaws.com:9500”,
index: table_query,
}
},

 

Here’s the logs of the failed requests for reference

{'HTTP_HOST': 'xxxx.herokuapp.com', 'HTTP_CONNECTION': 'close', 
'HTTP_UPGRADE_INSECURE_REQUESTS': '1',
'HTTP_USER_AGENT': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36',
'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
'HTTP_SEC_FETCH_SITE': 'none', 'HTTP_SEC_FETCH_MODE': 'navigate',
'HTTP_SEC_FETCH_USER': '?1', 'HTTP_SEC_FETCH_DEST': 'document',
'HTTP_ACCEPT_ENCODING': 'gzip, deflate, br',
'HTTP_ACCEPT_LANGUAGE': 'en,it;q=0.9,fr;q=0.8,en-US;q=0.7',
'HTTP_COOKIE': 'csrftoken=xxxx; sessionid=xxxx', 'HTTP_X_REQUEST_ID': 'xxxx',
'HTTP_X_FORWARDED_FOR': '46.6.166.39', 'HTTP_X_FORWARDED_PROTO': 'https', 'HTTP_X_FORWARDED_PORT': '443',
'HTTP_VIA': '1.1 vegur', 'HTTP_CONNECT_TIME': '2', 'HTTP_X_REQUEST_START': '1596540679766', 'HTTP_TOTAL_ROUTE_TIME': '0'}

Any tip on how to solve?

Public
Milena Pechura Milena Pechura Flexmonster 14 hours ago

Hi, Elia!
 
We are glad to hear that our recommendations helped you.
 
Please note that the article you referenced is related to Flexmonster Accelerator, not to the Data Server.
 
Our team would like to suggest browsing the security and authorization guide, which contains the HTTPS connection configuration.
 
Please let us know if it works for you.
 
Kind regards,
Milena

Please login or Register to Submit Answer