How to publish data located in an external database using Drupal?

I am very new to Drupal and get a bit of mixed browsing information, so I wanted to see if anyone could install me in the right way.

Here is my situation. I have a separate database (on the same Drupal database server) that has a lot of data that is supported by another team. We want to publish this data on the Internet, and with some suggestions, it looks like Drupal views are the way to go.

The problem is that I'm not sure where to go from there. I read the documentation and just looked at the Lullabot tutorial, but my data is not in the field columns.

I read one document that said I should "describe" my external Drupal database, but was not sure how to do it. I found several tools on drupal.org (services, etc.) which say that they can analyze my database and report the structure back to Drupal, but I cannot figure it out.

Basically the end result I want is two things. Firstly, just map the data, as from my external database, to the Drupal node (the only catch, each page is specific to the database object, although the data format / display is standard, the data itself will change using the link, for exmaple, www .example.com / ibm should only provide our data on ibm and as the company name changes, as well as the data displayed), and later I may want to perform some calculations on the data before it appears.

Anyone have suggestions on how to do this or any tutorials?

If this helps, I use Drupal 7.

On the side of the note, if this is not possible to do in Drupal, or even if it is, would it be better to create this in PHP and then wrap it in Drupal somehow? I discuss this because I think I know how to do this in PHP, and it can give me more control over the result (but I'm a bit lazy because I think Drupal can do this for me :-)

Update: Okay, now I'm even more confused. I looked at the opinions and can not get it to integrate with my database. I looked at schemas and channels as a way to describe a database or get it for replication using Drupal. I'm not sure if I will go in the right direction (or in the right direction), because so far everything that I am trying seems to be a dead end. Can anyone suggest a tutorial? Or relate your experience to this? I just want to display content from another database on the page (when users select a specific stock ticker), maybe I want to allow users to configure it later (which is why I think that views are needed).

+6
source share
2 answers

As for connecting to the database, in settings.php you can add additional connections to the database and use the db_set_active ('connection_name') function in the code to switch the active db connection to this source. Creating plugins for views is a large object that goes beyond a single answer. All I can say is Google and good luck, and come back with the specifics :)

+6
source

The Forena module can be used to query (not update) all types of databases, such as the MySQL database, and to create a database for connecting to external databases. And it comes with various hooks for using Forena from another module.

For more information about Forena, 2 types of documentation are available:

  • Community documentation .
  • The documentation that comes with Forena, which you can get right after installing and turning on the module. Make a demo site for an online example of the current:

    • Forena documentation - use the link "Reporting documentation" or visit the corresponding link / reports / help.
    • Forena examples - use the link โ€œSamples of reportsโ€ or visit the corresponding link / reports / samples (these samples are fully functional, so do not forget to experiment a bit with them, for example, available on the SVG Graph sample).

The new version 7.x-4.x also includes an amazing (I think) interface for creating your reports (WYSIWYG report editor) and / or for creating your SQL queries (Builder Query).

Here are a few mysql database options:

  • Using SQLite instead of the MySQL database: Forena samples are actually shipped, including the (Tiny) SQLite database. Go to the demo site: the data shows that there is data contained in the sampledb file, which is in SQLite format.
  • Forena comes with a full range of supported database connections ... such as MS SQL, Oracle, Postgress, or any PDO compatible options.

Enough reason to consider giving Foren a try? In doing so, use this queue for requests of any type of support / document that you may have.

Remember: I am a co-author of Forena.

+1
source

Source: https://habr.com/ru/post/887499/


All Articles