What is a DBAPI ?

 DB-API

DB-API


DB-API definition:

- We will sometimes want to interact with our database and use its results in a specific programming language.
 
- To build web applications or data pipelines in a specific language like (Ruby, Python, Javascript, etc.).

- That's where DBAPIs come in.


A DB-API: 

- A DB-API provides a standard for one programming language (like python) to talk to a relational database server.

- Is a low-level library for writing SQL statements that connect to a database. 

- Also known as database adapters.

- Different DBAPIs exist for every server framework or language + database system.

- Database adapters define a standard for using a database (with SQL) and using the results of database queries as input data in the given language.

-- Turn a selected (SELECT * from some_table;) list of rows into an array of objects in Javascript for say a NodeJS adapter; or a list of tuples in Python for a Python adapter.


Examples across languages and server frameworks:

- For Ruby (e.g. for Sinatra, Ruby on Rails): pg.

- For NodeJS: node-Postgres.

- For Python (e.g. for Flask, Django): pyscopg2.

Comments

Popular posts from this blog

SQLAlchemy library for python

SQLAlchemy Model.query cheat-sheet