Solved

I am using mysql executor to fetch pvoutput.org data into my mysql databases. The whole data is being fetched but its not going into my mysql databases

  • 8 November 2017
  • 7 replies
  • 1 view

Badge

INSERT INTO `stations`.`observation` (`station_id`, `date`, `time`, `energy`, `power`, `average`, `temperature`, `voltage` ) VALUES ( 1, @Value(interval_start), @Value(_timeOutSubstring), @Value(_dataEnergyOutString), @Value(_dataPowerOutString), @Value(_dataPowerAvgString), @Value(_dataTempString), @Value(_dataVoltString) )

icon

Best answer by david_r 8 November 2017, 15:58

View original

7 replies

Userlevel 4

It seems there are some issues with how the quotation marks are used. Try something like this:

INSERT INTO stations.observation (station_id, 
                                  date, 
                                  time, 
                                  energy, 
                                  power, 
                                  average, 
                                  temperature, 
                                  voltage)
VALUES (1,
        @Value(interval_start), -- Numeric value, not quoted
        '@Value(_timeOutSubstring)', -- String value, must be quoted
        '@Value(_dataEnergyOutString)',
        '@Value(_dataPowerOutString)',
        '@Value(_dataPowerAvgString)',
        '@Value(_dataTempString)',
        '@Value(_dataVoltString)')

Notes:

  • In SQL, single quotes are necessary for string literals. Note that you'll need to use straight quotes such as 'string', slanted quotes such as `string` usually won't work. You should not quote numeric values, although some database implementations will silently ignore the quotes for you.

     

  • In FME, don't put a semicolon at the end of the SQL statement unless you also define FME_SQL_DELIMITER at the start of your SQL statement, see this article for more info.
Badge

It seems there are some issues with how the quotation marks are used. Try something like this:

INSERT INTO stations.observation (station_id, 
                                  date, 
                                  time, 
                                  energy, 
                                  power, 
                                  average, 
                                  temperature, 
                                  voltage)
VALUES (1,
        @Value(interval_start), -- Numeric value, not quoted
        '@Value(_timeOutSubstring)', -- String value, must be quoted
        '@Value(_dataEnergyOutString)',
        '@Value(_dataPowerOutString)',
        '@Value(_dataPowerAvgString)',
        '@Value(_dataTempString)',
        '@Value(_dataVoltString)')

Notes:

  • In SQL, single quotes are necessary for string literals. Note that you'll need to use straight quotes such as 'string', slanted quotes such as `string` usually won't work. You should not quote numeric values, although some database implementations will silently ignore the quotes for you.

     

  • In FME, don't put a semicolon at the end of the SQL statement unless you also define FME_SQL_DELIMITER at the start of your SQL statement, see this article for more info.

 

Thank You David, I will apply this :)
Badge

pvoutputurl-customloopingreader-sqltrial9.fmw@david_r I tried this but its still not getting the data into my observation table

 

 

Previously I tried a syntax which somehow fetched the data to mysql observation table but I forgot the exact syntax

 

 

Kindly guide how I can get the data to my tables

Userlevel 4

What kind of error message are you getting? It's difficult to be specific without knowing your data and your database schema.

Badge

What kind of error message are you getting? It's difficult to be specific without knowing your data and your database schema.

There are no errors for now but I dont know why the data is not being going to mysql though it is appearing in fme inspector.pvoutputurl-customloopingreader-sqltrial9.fmw

 

 

Thank You

 

 

Badge

What kind of error message are you getting? It's difficult to be specific without knowing your data and your database schema.

I am not getting any error but the fme should transfer the data fetched to observation table.

 

In my view the whole thing is fine but dnt know where the issue is ..

 

 

 

Userlevel 4

You may want to consider dropping the SQLExecutor altogether and use a FeatureWriter instead, it should be much easier.

Reply