spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sujeet jog <sujeet....@gmail.com>
Subject Dataframe write to DB , loosing primary key index & data types.
Date Wed, 24 Aug 2016 14:37:01 GMT
Hi,

I have a table with definition as below , when i write any records to this
table, the varchar(20 ) gets changes to text, and it also losses the
primary key index,
any idea how to write data with spark SQL without loosing the primary key
index & data types. ?


MariaDB [analytics]> show columns from fcast;
+-----------------+-------------+------+-----+-------------------+-----------------------------+
| Field           | Type        | Null | Key | Default           | Extra
                    |
+-----------------+-------------+------+-----+-------------------+-----------------------------+
| TimeSeriesID    | varchar(20) | NO   | PRI |                   |
                    |
| TimeStamp       | timestamp   | NO   | PRI | CURRENT_TIMESTAMP | on
update CURRENT_TIMESTAMP |
| Forecast        | double      | YES  |     | NULL              |
                    |

I'm just doinig DF.write.mode("append").jdbc

Thanks,

Mime
View raw message