I am reworking a Hive script file. For debugging purposes I would like to set some blocks of code as comment. However I can't find a way to define such a comment block. Tried various options but none seem to work. Any hints?
Thanks,
Marco
Hive does not support multi-line comment.
Only single line comment are supported
Related
I'm trying to run a kusto query in Jupyter using Kql magic version 0.1.114.post16. I would like to remove the 500k lines limit and I think that the notruncate option listed when running %kql --help "client-request-properties" should solve my problem, but I can't figure out how to insert it in kql magic. It doesn't work as other options or commands.
I kind of solved this, even though I'm not sure whether this is the correct way to use Kql magic. I just added set notruncation; at the top of my query, like so
%%kql
set notruncation;
...
I'd like to have the --help specify a bit better that these are not options of the Kqlmagic commands but rather have to be put inside the query.
Today I am being asked to format long SAS script with mainly Proc SQL which are not readable (do not respect simple SQL rules of readability):
imbricated SQL queries with no indentation
case is not respected
etc...
I tried automatic SaS formatter but it do not format Proc SQL. Do you have any ideas ? We have many scripts and the Team is ready to do that manually, it seems prone to error and I am not sure we'll have the same syntax at the end.
Any tips would be welcome!
I can add code snippets if needed but I think that the problem is clear and I am not the first to encounter it.
I would suggest ignoring the fact that you're in SAS for the moment, and instead focus on the SQL itself. Find a language you're comfortable with that has libraries that format code in other languages - Python for example can do this - and then:
Open the .sas file as a text file
Find "PROC SQL" text and grab from there to the "QUIT" (case insensitive)
Pass that inner text to the SQL code formatter
Grab the result and insert it back into the text file
Something along those lines is your best bet. SAS doesn't have anything built-in for this, so you're going to have to go outside here.
I want to comment a query in .script file, how do I do this? I tested with #,--,({}),<--! -->,:: nothing worked. I get ad exception about unexpected token.
I was also having a problem with SQL stye comments in spring embedded database scripts. But it looked like it was because the beginning of each statement to the end of each statement was being processed as a single line thus any -- in the statement caused the rest of that statement, instead of just the rest of the line, to be commented out. So I trying switching to /* ... */ style comments and now life is much betters.
If you look HERE it says:
SQL Comments
-- SQL style line comment // Java style line comment /* C style line comment */ All these types of comments are ignored by the database.
But, in practice, at least when running from a spring embedded database script, these seem problematic.
HSQLDB stores the structure of the database in a file named dbname.script as a set of SQL statements. Normally, this file is not edited by the user. You cannot add comments to this file.
You can add comments on tables and columns with the SQL statement below:
COMMENT ON TABLE schemanme.tablename IS 'this is the user comment'
See the Guide:
http://hsqldb.org/doc/2.0/guide/databaseobjects-chapt.html#dbc_commenting
I reviewing some PL/SQL code and I came across the following in the scripts:
/
SHOW error
grant execute on someName1 to someName2;
/
SHOW error
Reviewing the documentation for PL/SQL I could not find an explanation what the /'s do.
Can anyone enlighten me?
Update: I opened the file that includes this script in SQL Developer for Mac. Compiling it gives the error "encountered the symbol '/'". Should these slashes be removed?
"/" executes the sql command in the current buffer. It similar to GO of SQL Server
The slash basically executes the latest command stored in the buffer.
It's kind of a clunky thing, but a lot of PL/SQL interpreters/engines like SQL Plus require you to enter a "/" after every complete statement to actually execute it and see the results.
http://download.oracle.com/docs/cd/B28359_01/server.111/b31189/ch12004.htm#SQPUG162
I have been researching a way to get the SQL statements that are built by a generated Migration file. These extend Doctrine_Migration_Base. Essentially I would like to save the SQL as change scripts.
The execution path leads me to Doctrine_Export which has methods that build the SQL statement and executes them. I have found no way of asking for just them. The export methods found in Doctrine_Export only operate on Doctrine_Record models and not Migration scripts.
From the command line './doctrine migrate version#' the path goes:
Doctrine_Cli::run(cmd)
Doctrine_Task_Migrate::setArguments(args)
Doctrine_Task_Migrate::execute()
Doctrine_Migration::migrate(to)
Doctrine_Migration_Process::Doctrine_Export::various
create, drop, alter methods with sql
equivalents.
Has anyone tackled this before? I really would not like to change Doctrine base files. Any help is greatly appreciated.
Could you make a dev server, and do the migration on that, storing a SQL Trace as you go?you don't have to keep the results, but you would get a list of every command.
Taking into account Rob Farley's suggestion, I modified:
Doctrine_Core::migrate
Doctrine_Task_Migrate::execute
When the execute method is called the optional argument 'dryRun' is checked. If true
then a 'Doctrine_Connection_Profiler' instance is created. The 'dryRun' value is then passed onto
the 'Doctrine_Core::migrate' method. The 'dryRun' value of true allows the changes to rollback when done executing the SQL statements. When the method returns, the profiler is parsed and non-empty SQL statements
not containing 'migration_version' are saved and displayed to the terminal.