# Understanding the Data Export tool connecting automatically to a web-hosted SQL database

**URL:** <https://forum.dimagi.com/t/understanding-the-data-export-tool-connecting-automatically-to-a-web-hosted-sql-database/2617>\
**Category:** Users\
**Created:** [February 25, 2016, 7:28am UTC](https://forum.dimagi.com/t/understanding-the-data-export-tool-connecting-automatically-to-a-web-hosted-sql-database/2617 "2016-02-25T07:28:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eric\_Stephan](https://dimagi.b-cdn.net/letter_avatar_proxy/v4/letter/e/c67d28/32.png) [@Eric\_Stephan](https://forum.dimagi.com/u/Eric_Stephan)\
**Post date:** [February 25, 2016, 7:28am UTC](https://forum.dimagi.com/t/understanding-the-data-export-tool-connecting-automatically-to-a-web-hosted-sql-database/2617/1 "2016-02-25T07:28:44Z")

</div>

Hi all --

I have been trying to learn more about the CommCare data export tool, and  
how it could connect to automatically do a regular upload to a SQL database  
that's hosted on a web server. I understand that if I did that, then  
Tableau or some other app could access it.

So, I was looking at the wiki site on the data export tool --  
[https://confluence.dimagi.com/display/commcarepublic/CommCare+Data+Export+Tool#](https://confluence.dimagi.com/display/commcarepublic/CommCare+Data+Export+Tool#)  
… and I was a little unsure at the start.

A few quite basic, newbie questions:

1-- My mental image is that the target SQL database would be sitting on a  
webserver somewhere, always accessible. But when I read the above  
instructions, it looks like it is really focusing on doing the steps of  
installing python and so forth on a local standalone PC.

Of course I do see that one of the three options in those instructions is a  
linux machine, but I’m still feeling like they’re talking about a desktop  
machine. Can you explain if these are the same instructions I would do  
from the command line of a hosted server and all that, if I am hoping to  
make the link to a SQL database that’s sitting on my webhosted space?

[Note, just to give you too much information, that I have in fact made a  
couple of blank databases on my inexpensive webhost. The hosting provider  
is Bluehost, let's say the web domain name is [www.example.com](http://www.example.com), I made one  
MySQL database called example\_commcaret1 and one PostgreSQL database called  
example\_commcaret2 … and for both of them I have a userID/password created  
with strong permissions.]

... So can anyone clear up this “desktop or not” question? Would I simply  
follow the instructions in the above wiki page, but do it from the command  
line of my hosted webspace?

2-- Am I right that when I set up this automatic export with the Data  
Export tool, I can make it export for only a specific subset of my commcare  
data? It doesn’t have to be the entire database? For example, I could make  
it only be records that were owned by a certain mobile users group, etc?

3-- Any other caveats, or any tips? For example, is my Bluehost webspace  
likely going to be able to handle this kind of automatic SQL export  
(provided that I do the configurations to access the command line, set up  
SSH/shell access, etc?)

Thanks much!

Eric

---

<div class="post-metadata">

**Author:** ![czue](https://dimagi.b-cdn.net/user_avatar/forum.dimagi.com/czue/32/493_2.png) [@czue](https://forum.dimagi.com/u/czue)\
**Post date:** [February 26, 2016, 11:00am UTC](https://forum.dimagi.com/t/understanding-the-data-export-tool-connecting-automatically-to-a-web-hosted-sql-database/2617/2 "2016-02-26T11:00:56Z")

</div>

Hey Eric,

Quick thoughts inline:

I have been trying to learn more about the CommCare data export tool, and

> how it could connect to automatically do a regular upload to a SQL database  
> that's hosted on a web server. I understand that if I did that, then  
> Tableau or some other app could access it.
> 
> So, I was looking at the wiki site on the data export tool --  
> [CommCare Data Export Tool - CommCare Public - CommCare Public](https://confluence.dimagi.com/display/commcarepublic/CommCare+Data+Export+Tool#)  
> … and I was a little unsure at the start.
> 
> A few quite basic, newbie questions:
> 
> 1-- My mental image is that the target SQL database would be sitting on a  
> webserver somewhere, always accessible. But when I read the above  
> instructions, it looks like it is really focusing on doing the steps of  
> installing python and so forth on a local standalone PC.
> 
> Of course I do see that one of the three options in those instructions is  
> a linux machine, but I’m still feeling like they’re talking about a desktop  
> machine. Can you explain if these are the same instructions I would do  
> from the command line of a hosted server and all that, if I am hoping to  
> make the link to a SQL database that’s sitting on my webhosted space?
> 
> [Note, just to give you too much information, that I have in fact made a  
> couple of blank databases on my inexpensive webhost. The hosting provider  
> is Bluehost, let's say the web domain name is [www.example.com](http://www.example.com), I made one  
> MySQL database called example\_commcaret1 and one PostgreSQL database called  
> example\_commcaret2 … and for both of them I have a userID/password created  
> with strong permissions.]
> 
> ... So can anyone clear up this “desktop or not” question? Would I simply  
> follow the instructions in the above wiki page, but do it from the command  
> line of my hosted webspace?

Yeah, the documentation was written assuming a desktop computer, but a  
similar process should be used for a server. Moreover, the script can run  
on a totally separate machine as the database if you wish (though it will  
be much more performant if it's running on the same machine as the  
database).

> 2-- Am I right that when I set up this automatic export with the Data  
> Export tool, I can make it export for only a specific subset of my commcare  
> data? It doesn’t have to be the entire database? For example, I could make  
> it only be records that were owned by a certain mobile users group, etc?

Yes, you should be able to define additional filters (though unfortunately  
docs are not great).

> 3-- Any other caveats, or any tips? For example, is my Bluehost webspace  
> likely going to be able to handle this kind of automatic SQL export  
> (provided that I do the configurations to access the command line, set up  
> SSH/shell access, etc?)

None that I can think of. Don't think it's particularly computationally  
expensive, so as long as you have a reasonable host and plenty of space for  
the data you should be all set!

cheers,  
Cory

> **···**
>
> \> \> \> \> Thanks much! \> \> Eric \> \> \> -- \> You received this message because you are subscribed to the Google Groups \> "commcare-users" group. \> To unsubscribe from this group and stop receiving emails from it, send an \> email to commcare-users+unsubscribe@googlegroups.com. \> For more options, visit https://groups.google.com/d/optout. \>
