All Apps and Add-ons

Splunk DB Connect: Can I run a truncate table statement?

jedatt01
Builder

Is there a way to make Splunk DB Connect support truncate table statements? When I try to run one it says "A ResultSet was expected but not generated from query "x". Query not executed.

0 Karma

tmuth_splunk
Splunk Employee
Splunk Employee

As @DalJeanis stated, this is probably only going to work as a stored procedure or a function. DBX isn't tested against Vertica for stored procedure calls, but it might work. Take a look at this link for an example of creating a function in Vertica and calling it from a SQL statement:
https://my.vertica.com/docs/7.0.x/HTML/Content/Authoring/SQLReferenceManual/Statements/CREATEFUNCTIO...

0 Karma

DalJeanis
Legend

It's complaining that you need to return a result set. There are ways to do that.

For instance, you could put your truncate into a stored procedure which then returns a return code.

Other than that, I'm not sure to what degree dbxquery supports standalone DDL as opposed to pure SQL statements. I do know that it only supports stored procedures that return a single result set, as per this page....

http://docs.splunk.com/Documentation/DBX/3.1.1/DeployDBX/Commands

"Important notes on stored procedure support in DB Connect: dbxquery only
supports stored procedures which return a single result set."

It is also possible that there is some option in dbxoutput that would allow this, but I don't find it in the docs.

@somesoni2? @woodcock? @niketnilay?

Similar question asked here was never answereed... https://answers.splunk.com/answers/510857/truncate-table-with-db-connect-2.html

0 Karma

jedatt01
Builder

Can dbconnect call functions instead? I have vertica and it does not do stored procedures in the traditional sense.

0 Karma

woodcock
Esteemed Legend

I would try creating a stored procedure that calls truncate. That should work.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...