Impala can not read built in functions after restart - impala

I have noticed that after restarting impala I ran some queries and two of them threw an error for to_timestamp() function that I have in my view. If I rerun these queries everything runs smoothly. Why is this happening? It is like impala can not read the functions in the first-run of the queries.

Related

Run dbt without compiling

Is it possible to do a dbt run with the already compiled code without the compilation being run again?
I have a project that takes a lot to compile and the running time is quite low, and I have to run it 1000s of times.
The partial-parse flag is what you're looking for.
The answer is not entirely correct.
Partial parsing does not prevent compilation - it simply prevents parsing of unchanged files. Models are compiled anyway, and you can check this by placing a "run_query" call in any model and compiling with partial parse many times. You still get better times, but compilation is unavoidable.

PostgreSql - Queries not executed correctly within PgAdmin

I have installed PostgreSql 9.6 for Windows. And a problem arised with PgAdmin 4. First of all the UI looks corrupted: some lines between the components of a tree on the left side are missing.
Also queries are not executed correctly.
For example, when creating a table, the query returns successfully. However the table is not actually displayed after refreshing the Tables or Schemas component on the left. As well as the SELECT * FROM emp; query returns successfully but doesnt show any data.
This is the first time I'm facing such a problem with PostgreSql for two years working with it. And I haven't fount any relevant information after researching the issue. Will be grateful for any hints about the possible cause of such beahavoiur. Especially confusing is the currupted UI. Could it be that I need to install additional libraries?
Installation of PostgreSql 10.2 instead of 9.6 did not solve the problem.
I've also noticed that when clicking a + to expand the components on the left, they are all empty and don't look as usual in PgAdmin.
There were many issues in pgAdmin4 runtime(aka Desktop application) which was built on top of Qt5.
Could you try again with latest development version, Download: https://developer.pgadmin.org/~dpage/runtime-revamp/
Let us know if that solves your problem.

Automate SQL Script with Multiple Statement Types

I have a SQL script that works exactly as I want it to when I step through it line by line. At first, this was a viable option, but the script has gotten larger over time and stepping through it now sucks.
I've tried to run the script as part of an SSIS package in Visual Studio, but that gave me weird results.
I have a feeling this is because I have mixed language in the script, (i.e multiple UPDATE, ALTER, SELECT INTO, statements) ... Is there a way to automate this script so it runs line by line as if I were stepping through it?
be kind. and thank you!
Generally speaking. All you need is a semi-colon after each statement, this is regardless of statement types. "Go" is only needed if you want to separate it into batches (although it might not work if you are passing the code through to something else, ie. ADO.NET command object). This is helpful if you want the code to continue running regardless of the success or failure of the code before the "go". If you want the continuation of the code to depend upon the previous code just make sure to end each statement with a ";"

How do I compile Oracle SQL scripts?

I have a series of SQL files, and I want to compile all of them. If do them manually by using benthic software, it takes a long time. I tried using TOAD, but I don't like to use cracked software. Can you help me execute a SQL file? I want to write a program to do some things for me.
From sql/plus I tried to create batch file but in some of my sql file developer used "/" and ";" so it caused sql/plus suddenly stopping the compilation. Please advise or recommend free software to help.
"I want apply the sql package , function and if they are invalid compile them again"
I am using oracle 10g.
Thanks
If you search for something like TOAD, try SQL Developer, a free tool from Oracle.
If you want to recompile existing source in your database, you can use dbms_utility.compile_schema.
If you try to install several files in a batch, SQL*Plus should work for you. Make sure that your files have the right format.
It sounds like you need to run a large sql script. Correct? Sql/Plus should work, but if you want a free IDE, I recommend SQL Developer. It isn't perfect, but it is one of the better free solutions.
"in some of my sql file developer used "/" and ";" "
You need to consistently use these to have any hope of using a tool to deploy. You don't want to have to use a GUI to deploy, so SQL*Plus is the standard to aim for. A good Oracle GUI should be able to run a SQL*Plus deployment script.
I generally start with SET DEFINE OFF otherwise unexpected ampersands (&) cause issues.
Do some basic grepping - any script with a CREATE PACKAGE, CREATE PROCEDURE, CREATE TRIGGER or CREATE TYPE (including CREATE OR REPLACE) should have a the "/" to execute that statement. If they don't, fix them.
For a first run though, I'd take them in batches of 10, until I was sure that they executed correctly. I wouldn't worry about compilation errors as long as they load. Afterwards, you can do a recompile of any invalid objects in the schema.
Then check USER_ERRORS to see what is still broken.

Check sql script valid

As part of a release we run a load of PL/SQL scripts against a database. Recently someone left the ; off the end of a line in one script that was called another script so this meant that script did not get run. Because this did not cause an error, it just didn't get run, it took quite a while to track down what had happened.
I want to check the scripts before they are run for lines in them that are missing either a ; at the end or a / on the line after. This is made more complicated as 'lines' in the script could actually span more than one line if it is statement or block of code.
To me this seems like to do this I'm going to have to parse the scripts then check they meet the above.
I've found ANTLR and wonder if this might be a way to do it since there seem to be existing PL/SQL grammars but looks like that's going to be a step learning curve for what's just a simple check.
Does anyone know an easy way or any other tools, eclipse plugins etc that I can use to check for lines in the scripts that are missing either a ; at the end or a / on the line after?
Update
We already do most of the stuff Tom H suggested. The scripts are run into our test server and we have a version table that gets updated at the end. The problem was that the missing semi-colon in the container script meant one script did not get run but the rest including the one to update the version number ran without errors. Therefore the problem only got picked up quite a way into testing. This needed the database restored before running the scripts with the missing semi-colon added so basically resulted in half a day of testing time being lost. If there was a simple way to check this before running the scripts into the test server it could save quite a bit of time.
I agree with MattH that you may be going about this the wrong way. I would just add an insert statement to the end of all of your scripts which insert a "version" row into a table in the database. At the end of your deployment scripts it's then an easy task to check that the version table has all of the correct rows in it.
Also, you should have all of your release scripts being run exactly as they will be in production against your QA server. That's where all of the testing takes place. You never do anything to the server besides what is in your release steps - you only run the release scripts and if those release scripts are ever changed then you refresh the QA server with them and redo testing.
When you go to production your release process has then been fully tested. As a fail safe measure you can also use tools like Red Gate's SQL Compare and SQL Data Compare to check that production matches the QA server. The data compare would only be against certain tables (look-up tables, etc.). If you have data changes to major tables (1M rows, etc.) then you can right a custom script to check that they are correct.
Even if the scripts are different for every release (and not part of a defined source control structure that creates or replaces database objects) I would adopt a practice of breaking the scripts down into the most fundamental units of work per file and deploying them through Ant with the standard sql task. You probably have these types of scripts:
CREATE or REPLACE dbobject...
SQL DML scripts
Anonymous PL/SQL blocks
If you standardize on a consistent statement delimiter (I suggest using "/" since it works with all of the cases above) and set the deployment to fail on error, then Ant will either deploy all of the files or indicate why it couldn't.
I think it would be very difficult to otherwise parse files of one or more SQL and/or PLSQL statements and find missing delimiters if there are no standards on delimiter choice or statements per file.
Just a thought, but are you going about this the wrong way?
I assume, at the file-level, the lack of a semi colon in the file was not a problem? but it only became a problem when run via the batch processing? If that's the case maybe you can change your batch processing to cope with this.
If it was the file, then testing should have picked it up. You don't want to parse your input files to make sure they compile etc.