How is that,I am able to compare date() to string in hive query builder but not in beeline?
Example.
where date(timestamp) = '2019-..-..'
is working in query builder and not in beeline
Related
I use MyBatis3 Dynamic SQL (pure java generated sql without any xml mapper) in spring with mysql as db.
When I have an entity with value of Date type, MyBatis will change the value to timestamp format in generated sql query.
For example:
public class Log {
public Date requestTime;
}
I used yyyy-MM-dd HH:mm:dd as date format.
The value in mysql db is saved as 2022-09-01 08:08:08.
However, mybatis dsl generates query sql with value as 2022-09-01 08:08:08.0. This makes searching result 0 when using where(requestTimeColumn, isEqualTo(requestTime)). The requestTime is the parameter for search as Date type.
btw: The Java Date type is java.util.Date.
Beginner
Im trying to use sqoop import from Oracle to HDFS
I get error message -
SQL command not properly ended , Import Failed : java:IOexception : No >column to generate for ClassWriter
my query is
--query "select a,b,c from db.table where date = to_date('9999-12-31','yyyy-MM-dd')" where \$conditions"
Your query contains two WHERE clause, this is syntax error. Use AND to add $conditions to the same WHERE, whole query should be double-quoted, including $CONDITIONS, it is the part of the same WHERE, and in your query double-quotes are broken.
Like this:
--query "select a,b,c from db.table where date = to_date('9999-12-31','yyyy-MM-dd') and \$CONDITIONS"
Check what exactly sqoop executes, does it resolve correctly or not (conditions passed correctly), use --verbose to get more information and fix query accordingly.
Today I was using datagrip with the new view of MariaDB, and at executing
SELECT DATE('2018-03-01');
return '2018-02-28'. Meanwhile on MySQL view return the same Date that I put as String version.
I use MariaDB 10.1.26 with XAMP, Datagrip 2018.1.
It's the first time that make this.
Try use the CONVERT_TZ() because your problem is probably related to timezone, who are different their two instances (Maria and My), or update the timezone in the instances to be the same.
To check the timezone:
select ##system_time_zone;
This question might be lazy question. While I was using netbean to run query and also sql workbench then each time I run query and use it in .java file as
String sql = "select * from some table "+
"where table.col = 'sth'" //the query is not this short
Adding + and "" easily without going to each line and adding in 100 line of query.
Is there any way that netbeans or Oracle sql developer support direct export ast this kind of string or is there any other alternative.
Using Advance Format you can. HUrray! IN oracle SQl Developer
I need to execute this query:
Select * from my_schema.table_within_schema
Unfortunately groogy.sql.SQL is removing my_schema and executing a query without schema information:
Select * from table_within_schema
I wonder if it is possible to force groovy.sql.Sql to keep a schema name in the query.
Groovy: 1.7, Db: I use a jdbc driver that requires a schema name specified.
I haven't run into this situation yet but you can 'force' groovy to use a String query instead of a GString if you want to, below is a mysql jdbc example:
Sql sql = ...(the usual)
def query = "SELECT * from `my_schema`.mytable"
sql.eachRow( query.toString() ) {
// do something
}