Can I call Databases on a Deployed API using Python?

Options
Connor
Connor Registered Posts: 2
edited July 16 in Using Dataiku

I have several databases that I'd like to access from an API I'm deploying. The databases are stored in the following postgres table:

api-node-referenced-data

I currently have many different SQL queries that are used to access the tables, but I'd like to change them all to a parameterised query in Python to avoid repeated manual work. However, I can't find any documentation on this topic.

Is it possible to use Python to access the postgres SQL database from a deployed API?

Answers

  • Turribeach
    Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 1,731 Neuron
    Options

    I am not sure what you mean by “databases stored on Postgres tables”. In Postgres you can have databases and these databases can have tables which store data.

    With regards to connecting to Postgres from a deployed API in the API node this can certainly be done. There are several ways to do this so it will depend on how you want to architecture it:

    1. You could use the Dataiku API to connect back to your Automation node and read the datasets using the Dataiku API
    2. You could add the Dataiku connection to the API node and connect directly from the API node using Dataiku Python methods
    3. You could install the relevant Python packages in your Python code environment and connect directly from the API node using pure Python methods

Setup Info
    Tags
      Help me…