Is there a way to change the default date_format in MemSQL - I'd like to change it to "%m/%d/%Y" instead of the default "%Y-%m-%d", so that i can load data in that format from csv files.
I got error message when try to set it.
mysql> SET ##GLOBAL.date_format = '%m/%d/%Y';
ERROR 1238 (HY000): Variable 'date_format' is a read only variable
Appreciate for any help.
Unfortunately MemSQL follows MySQL for a lot of system variables and as you can see in their docs the default date_format variable is unused: http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html#sysvar_date_format
Furthermore, currently MemSQL does not support transforming a particular column during a load.
Keep an eye out to some awesome solutions to this and other similar problems in our next release.
Related
I am using logstashto read the postgres data using jdbc input plugin and push to elastic
The data is coming properly and things seems to be working fine just for a small problem i.e.
My logs table has a field requesttimestamp with datatype of timestamp. Since there is a historical data and also to ensure that the timelines are based on the data and not the time of run, I am trying to set the value of #timestamp with requettimestamp.
the filter configuration is as follows:
{
match => ["requesttimestamp", "yyyy-MM-dd HH:mm:ss.SSS"]
}
but while running it is tagging it as _dateparsefailure and using the system time as #timestamp
I also tried using the following format : ISO8601 but nothing seems to be working.
I am sure it is something simple but not able to put the finger to it.
I am using java8 and cassandra in my application.
The datatype of current_date in cassandra table is 'date'.
I am using entities to map to the table values. and the datatype in entity for the same field is com.datastax.driver.core.LocalDate.
When I am trying to retrieve a record
'Select * from table where current_date='2017-06-06';'
I am getting the following error'
Caused by: com.datastax.driver.core.exceptions.CodecNotFoundException: Codec
not found for requested operation:
['org.apache.cassandra.db.marshal.SimpleDateType' <->
com.datastax.driver.core.LocalDate]
I faced a similar error message while querying cassandra from Presto.
I needed to set to cassandra.protocol-version=V4 in cassandra.properties in Presto to resolve the problem in my case.
If you get this problem while using a java SDK application, check whether changing protocol version resolves the problem. In some cases, you have to write your own codec implementation.
By default, Java driver will map date type into com.datastax.driver.core.LocalDate Java type.
If you need to convert date to java.time.LocalDate, then you need to add extras to your project :
You can specify codec for given column only:
#Column(codec = LocalDateCodec.class) java.time.LocalDate current_date ;
If these two didnot work, please have a look into the code how you are creating the session,cluster etc to connect to database. Since date is a new addition to cassandra data type, Protocol version can also have an impact.
Update the version accordingly
I am stuck on a problem and I am not sure what is the best way to solve it. I have a date column that I want to select and I want to fetch it as a string. Which is great, node-oracledb module has this option with fetchAsString mehotd. But it fetches the date like this for example 10-JAN-16 and I want to fetch it like this 10-01-2016. Is there a way to do that from the node-oracledb module, or I should modify the date after I get the result from the query?
UPDATE: I mean solution without to_char in the query and without query modifications
Check out this section of my series on Working with Dates in JavaScript, JSON, and Oracle Database:
https://dzone.com/articles/working-with-dates-using-the-nodejs-driver
The logon trigger shows an example of using alter session to set the default date format. Keep in mind that there is NLS_DATE_FORMAT, NLS_TIMESTAMP_FORMAT, NLS_TIMESTAMP_TZ_FORMAT.
I only show NLS_TIMESTAMP_TZ_FORMAT because I convert to that type in the examples that follow as I need to do some time zone conversion for the date format I'm using.
Another way to set the NLS parameters is to use environment variables of the same name. Note that this method will not work unless you set the NLS_LANG environment variable as well.
I am using nodejs and recently started using moment.timezone to get the timezone offset. I have the following code:
console.log(moment.tz(new Date(), 'Europe/Athens').zone()); // Prints -120
The timezone for 'Europe/Athens' is GMT+2 so i would expect getting '120' and not '-120' and thats what other timezone libraries do.
This issue caused me a serious head scratching bug. It was really easy to fix it once found the problem by just inverting the timezone offset.
Is this a bug on the specific library, or is there a different way to think of zones and offsets? Is there a standard about zone offsets?
This is expected behavior. zone() returns the offset to UTC relative to the selected timezone.
http://momentjs.com/timezone/docs/#/how-to/mutator/
I have upgraded Cassandra from v0.6 to v0.7.2 following the instructions in NEWS.txt. It seemed to be successful, except that the column value has changed.
For example, in 0.6, there was a column that looked like this:
(column=Price, value='2.5')
Now, in 0.7.2, the same column has changed to this:
(column=Price, value=32392e3939)
How can I fix this problem?
The CLI no longer makes assumptions about the type of data you're viewing, so all outputs are in hex unless the data type is known or you tell the CLI to assume a data type.
See this section of the documentation on human readable data in the CLI for more details.