You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Jay Potharaju <ja...@gmail.com> on 2014/02/14 01:53:54 UTC

Solr dataimporthandler use storedProcedure in deltaImportQuery

I was wondering if its possible to call a storedProcedure in the
deltaImportQuery. This is what I 'm trying to do.

  <entity name="entity1" transformer="RegexTransformer" pk="id"
            query="SELECT * FROM table1
             INNER JOIN tabl2 ON table2.tbl1Id = table1.id"

        deltaImportQuery="exec populatetable2 ${dih.delta.id}"

        deltaQuery="select id from table1 where dtmodified >
'${dih.last_index_time}'"
 </entity>

In my store procedure I am deleting n rows and inserting them back. And
then finally run a select statement to get some data back from the delta
import query.

Can anyone tell me if this is possible in solr or not?

Thanks

Re: Solr dataimporthandler use storedProcedure in deltaImportQuery

Posted by Shawn Heisey <so...@elyograg.org>.
On 2/13/2014 5:53 PM, Jay Potharaju wrote:
> I was wondering if its possible to call a storedProcedure in the
> deltaImportQuery. This is what I 'm trying to do.
> 
>   <entity name="entity1" transformer="RegexTransformer" pk="id"
>             query="SELECT * FROM table1
>              INNER JOIN tabl2 ON table2.tbl1Id = table1.id"
> 
>         deltaImportQuery="exec populatetable2 ${dih.delta.id}"
> 
>         deltaQuery="select id from table1 where dtmodified >
> '${dih.last_index_time}'"
>  </entity>

I would expect that any SQL that can be sent as a query via your JDBC
driver should be supported.  Your best bet is to try it.  If you know
Java, you could write a simple Java program using your JDBC driver that
attempts the query.

One detail -- in order to work with newer versions of Solr/DIH, all of
your queries must return a result that includes a column with your
entity's pk value as the column name.  For that reason, I have this as
my deltaQuery:

  deltaQuery="SELECT 1 AS did"

Thanks,
Shawn


Re: Solr dataimporthandler use storedProcedure in deltaImportQuery

Posted by Ahmet Arslan <io...@yahoo.com>.
I think it is not possible to use stored procedures in DIH. 
Please see : https://issues.apache.org/jira/browse/SOLR-1262



On Friday, February 14, 2014 3:02 AM, Jay Potharaju <ja...@gmail.com> wrote:
I was wondering if its possible to call a storedProcedure in the
deltaImportQuery. This is what I 'm trying to do.

  <entity name="entity1" transformer="RegexTransformer" pk="id"
            query="SELECT * FROM table1
             INNER JOIN tabl2 ON table2.tbl1Id = table1.id"

        deltaImportQuery="exec populatetable2 ${dih.delta.id}"

        deltaQuery="select id from table1 where dtmodified >
'${dih.last_index_time}'"
</entity>

In my store procedure I am deleting n rows and inserting them back. And
then finally run a select statement to get some data back from the delta
import query.

Can anyone tell me if this is possible in solr or not?

Thanks