DBAPIs and psycopg2

发布时间:2022-06-30 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了DBAPIs and psycopg2脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。

We will sometimes want to interact with our database and use its results in a specific programming language. E.g. to build web applications or data pipelines in a specific language (Ruby, Python, Javascript, etc.) That’s where DBAPIs come in.

  • A DBAPI
    • provides a standard interface 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
    • is 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.

Example 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

脚本宝典总结

以上是脚本宝典为你收集整理的DBAPIs and psycopg2全部内容,希望文章能够帮你解决DBAPIs and psycopg2所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: