How does CKAN fetch data from a database? How does it retrieve data from a Link while viewing it (when we are not using Datastore)?
I am using CKAN 2.7.2.
By default, CKAN does not fetch any data from an external database. This also means that, by default, you can only use the basic preview widgets that display the document at the resource's URL as plain text, image or an embedded web page. In that case, the resource document is not fetched by CKAN but by the user's browser via JavaScript.
If you want to use the more advanced preview widgets that support tables, filtering, etc. then the resource data needs to uploaded into CKAN's internal DataStore. This is typically done using the DataPusher, which automatically uploads new resource data into the DataStore. The DataPusher runs on the same server as CKAN, so in contrast to the basic default preview widgets this process happens on the server side.