HIVE CREATE TABLE sematicException 0:0 - hive

HI, all :
i am newbie at hive, i got this error when i was creating a table using "select from " syntax,
my input is as following:
`hive>create table longyuan_web.tmp_recent_week_data_cookies as
select u from longyuan_web.ods_mbw_user_pv where dt>='2018-07-19'
and dt<='2018-07-25'and platform='31'
and u is not null and length(u)>=32
and os='ios' group by u`
i get this error:
FAILED: SemanticException 0:0 Error creating temporary folder on: hdfs://hadoop-bd-ns01/hive/warehouse/longyuan_web.db. Error encountered near token 'TOK_TMP_FILE'
i am pretty sure i am on the right cluster and the original table is also on this cluster
what this 'TOK_TMP_FILE'?
thank you so much!!

Mostly the issue is user doesn't have access to write to longyuan_web database.
Please check that you have correct permissions and then try to execute then execute CTAS again.
Jira ticket addressing same exact issue is here

That's right.
(I assume Your select query runs good as stand-alone)
You have read access in longyuan_web db. But not write access.
Work around is...
Try to create the table in some other db where you have write access, like....
`hive>create table **xxx_web**.tmp_recent_week_data_cookies as select u from longyuan_web.ods_mbw_user_pv where dt>='2018-07-19' and dt<='2018-07-25'and platform='31' and u is not null and length(u)>=32 and os='ios' group by u` as select u from longyuan_web.ods_mbw_user_pv where dt>='2018-07-19' and dt<='2018-07-25'and platform='31' and u is not null and length(u)>=32 and os='ios' group by u`
Where xxx_web is the Db where you have write access.

Related

SQL (DB2) Creating table by selecting from other table

I´ve read several discussions and websites about creating a SQL query to create a table by selecting data from other table, but none of them solved my issue. I don´t know what else to do.
I am working on a SQL script to run a sequence of selects and creates do resume some data. I´ve been using this SQL queries on a SaS server using DB2 data. Now I need to migrate to Dbeaver to using other sources.
I just want to create a table by selecting some columns and data from other table, for this simple example :
"CREATE TABLE DB2XXXX.PaidResume AS
(SELECT HistoricalPaid.AccountNumber AS CONTA
FROM DB2XXX.HistPaid HistoricalPaid
WHERE HistoricalPaid.AccountNumber = 'XXXXX');
All I got it this error
Error occurred during SQL query execution
SQL Error [42601]: ILLEGAL SYMBOL "<END-OF-STATEMENT>". SOME SYMBOLS THAT MIGHT BE LEGAL ARE:. SQLCODE=-104, SQLSTATE=42601, DRIVER=4.19.26
If I just exclude the "CREATE TABLE DB2XXXX.PaidResume AS" and run the select only, it works.
You must include WITH DATA or WITH NO DATA at the end of the SQL statement. For example:
create table u as (select a from t) with data;
See example at db<>fiddle.

Unable to access the temp tables in azure sql database

Using following code I have created a temp table in azure sql database.
CREATE TABLE ##UpsertTempTable (
eno varchar(25),
ename varchar(25)
);
and I am want to check the data using the below query
select * from ##UpsertTempTable
Ideally it should run without any issue as in all of the azure documentation it works without any issues but unfortunately it is not working and giving below error.
I tried looking solution in all places in the internet but could not find any relevant documentation for this issue.
Error : Failed to execute query. Error: Invalid object name '##UpsertTempTable'.
I tried in Query Editor(Preview) in Portal, and create temporary table code doesn't work. I both used ##UpsertTempTable and #UpsertTempTable.
For example, when we run the code, no error happens .
When you run select * from ##UpsertTempTable, Query editor will gives the error:
I also try with SSMS V17.9 and SSMS V18.1, everything is ok.
What I think is the query editor doesn't support create temporary table well.
I asked Azure Support and wait their replay, please wait my update.
Update:
Azure Support replied me:
"This is by design, the temp tables exists as long as the connection is open.
The current way portal query editor is designed, the connection is killed resulting in temp table being deleted.
"
Hope this helps.

query is running but failed to create view in biqquery

I would like to create view by using multiple tables . While creating view getting "FAiled to save View , column not found do u mean that this column" but if you run the query . I am getting data. Can you please help to resolve this issue
Most likely you are missing project(s) to be specified in your query
You should fully qualify tables as
[project:dataset.table] if you are using Legacy SQL or
`project.dataset.table` if you are using Standard SQL

MS Access SQL error with Update Query

working on linking data between a SQL Server Database and MS Access. Right now someone is manually calculating Data from a SQL Database report and entering this into Access to run other reports within Access.
I have created a pass through query to pull the relevant information into an Access Table from the SQL Database( all working nicely )
Now I need to update the existing Access Tables with Data retrieved from the SQL pass through. I have tried a number of different queries all fussing at me for various reasons. Here is an example of the latest query that will get me what I need. This works if I setup a Sandbox in SQL Server and run it MSSQL Management Studio, but will not work in access
UPDATE JT
SET JT.ContractAmt = SBD.TotalSum
FROM JobTable_TEST AS JT
INNER JOIN (
SELECT Sum( Main.amt ) as TotalSum, Main.job
FROM Main
GROUP BY Main.job
) AS SBD
ON SBD.job = JT.JobNumber
In Access the Above Generates the following error "Syntax error( missing operator) in query expression.
Updating following attempt at using SQL Passthrough to run the update Query.
I updated my Query to do this directly from a Passthrough SQL Statement as suggested and get the following error.
ODBC--call failed.
[Microsoft][SQL Server Native Client 11.0][SQL Server]Invalid object name 'TableName'.(#208)
Here is what the pass through query i used looked like.
UPDATE AccessTable
SET AccessTable.amt = SQLResult.Total
FROM TableName AS AccessTable
INNER JOIN ( SELECT SUM( SQLTableA.amt) as Total, SQLTableA.job
FROM SQLTableA
LEFT OUTER JOIN SQLTableB ON (SQLTableA.company = SQLTableB.company)
AND (SQLTableA.job = SQLTableB.job)
GROUP BY SQLTableA.job
) AS SQLResult
ON SQLResult.job = AccessTable.JobNum
hopefully that better describes where my tables are located and how my update needs to happen, and maybe someone can point out how this is wrong or if it will even work this way.
Any suggestions would be greatly appreciated
It appears your subquery, aliased as SBD, is missing a job_no column. Therefore you aren't going to be able to join on it.

How to move table data from one environment to another environment in Oracle

I am a novice Oracle User.
I want to move a table records from QA to Test environment. The table already exists in Test. Would it be something like this ?
insert into wKTest01.MyTableIWantToMove select * from wkQA01.MyTableIWantToMove ;
Any help is greatly appreciated.
Both the tables in both environments have same number of columns with same data types.
You can use database links in Oracle to do this.Create a database link in your test database called myQADBLink which points to your QA DB.
The code would look something like this
CREATE DATABASE LINK myQADBLink CONNECT TO <username> identified by
<password> USING
'<QA DBconnect string>';
SELECT 1 FROM dual#myQADBLink; -- This is to test if your dblink is created properly.
Now you can copy from QA to test by saying
INSERT INTO wKTest01.MyTableIWantToMove select * from wkQA01.MyTableIWantToMove#myQADBLink;
Yes, it actually exists, right like you put it.
Here is the full syntax guide for this: http://docs.oracle.com/cd/E17952_01/refman-5.1-en/insert-select.html.
Later, when you might place your tables at the different Oracle instances, google 'Orace DBLink' for the good ;)