Specify data types for PHP data compressor from postgres

Answered
Simon asked on May 21, 2019

I’m trying to use FlexMonster to create a Pivot table from a Postgres source.
So far I’ve setup a basic PHP compressor server using your example code. This connects to the Postgres DB and streams the data.
I can see the data coming through correctly to the table, but it looks like the type information is somehow lost, and everything is interpreted as strings. (for example I can only aggregate as “Count” or “Distinct Count” and not “Sum”)
If I change the compressor to read from a csv file instead, everything works as expected, and the data types look correct.
Is there someway to preserve the data types using the PHP Postgres compressor? Or do I need to use another solution?
Thanks!
 
 

4 answers

Public
Dmytro Zvazhii Flexmonster May 22, 2019

Hello Simon,
Thank you for writing to us.
 
It seems that the column types are not recognized correctly by the Data Compressor.
As a temporary solution, we recommend using SQL alias to define the data types explicitly. Please refer to the following thread for the example: https://www.flexmonster.com/question/flexmonster-pivot-doesnt-treat-numeric-columns-as-numbers-when-using-compressor-for-database/.
 
Also, could you please provide us with the SQL schema of your table? That would help us a lot to resolve the issue with the Data Compressor.
 
Waiting to hear from you.
Regards,
Dmytro

Public
Simon May 22, 2019

Thanks Dmytro,
I’ve attached the schema for this database – currently we select everything from this (“SELECT * FROM …”)
Regards,
Simon.

Public
Dmytro Zvazhii Flexmonster May 22, 2019

Hello Simon,
Thank you for providing us with the screenshot of the schema. That was really helpful.

It seems that the double precision data type is not recognized correctly.
Our dev team will add the necessary update in the minor release with ETA Jun17.

Meanwhile, you can use the suggested workaround for testing.
Please let us know if everything works fine for you.
Regards,
Dmytro
 

Public
Simon May 23, 2019

Thanks!

Please login or Register to Submit Answer