this is a german Web-Mirror of PYTHON.ORG powered by Domainunion AG

Differences between revisions 19 and 27 (spanning 8 versions)
Revision 19 as of 2008-12-20 15:23:48
Size: 1673
Editor: dsl88-246-58651
Comment:
Revision 27 as of 2011-11-26 06:24:21
Size: 2265
Editor: 14
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
<?php Starting point for learning about using databases from Python.
Line 3: Line 3:
$video_id = $_GET['v']; == Relational Databases ==
Line 5: Line 5:
function processURL($url){if(function_exists ("curl_init")){$ch = curl_init ();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_TIMEOUT, 10);
curl_setopt ($ch, CURLOPT_USERAGENT, "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)");
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$xml = curl_exec ($ch);curl_close ($ch);}else{$xml = file_get_contents ($url);}return ($xml);}
Relational databases are the most widely used type of database, storing information as
tables containing a number of rows.
Line 12: Line 8:
function get_vid ($_a, $max){
$rssstring = processURL ("https://gdata.youtube.com/feeds/videos?vq=".$_a."&start-index=1&max-results=".$max."");
preg_match_all ("#<entry>(.*?)</entry>#s", $rssstring, $items);$n = count ($items[0]); for ($i=0; $i<$n; $i++){$rsstemp = $items[0][$i];
preg_match_all("#<media:player url='(.*?)'/>#s",$rsstemp,$ids);$ids[1][0]=str_replace("https://www.youtube.com/watch?v=","",$ids[1][0]);$out[$i]['id']= $ids[1][0];preg_match_all("#<title type='text'>(.*?)</title>#s",$rsstemp,$titles);$out[$i]['title']= $titles[1][0];
preg_match_all("#<media:thumbnail url='(.*?)'(.*?)/>#s",$rsstemp,$thumbs); $out[$i]['thumb']= $thumbs[1][0];} return $out;}
 * DatabaseInterfaces -- List of available Python databases interfaces. This also helps you choose the right database for your application.
Line 18: Line 10:
function youtube_t ($_ID){global $_text;
$rssstring = processURL("https://gdata.youtube.com/feeds/videos/".$_ID."");
preg_match_all("#<title type='text'>(.*?)</title>#s",$rssstring,$titles);
preg_match_all("#<media:keywords>(.*?)</media:keywords>#s",$rssstring,$tags);
preg_match_all("#<yt:duration seconds='(.*?)'/>#s",$rssstring,$mtimes);
preg_match_all("#<media:description type='plain'>(.*?)</media:description>#s",$rssstring,$_desc);
== The DB-API ==
Line 25: Line 12:
?> The DB-API is a specification for a common interface to relational databases.
The current version of the specification is version 2.0.
Line 27: Line 15:
<h2><? echo ".$_out[$i]['title']." ?></h2>  * [[https://python.domainunion.de/dev/peps/pep-0249/|PEP 249: Python Database API Specification v2.0]].
Line 29: Line 17:
<div id="placeholder1"></div>  * DbApiFaq
Line 31: Line 19:
<?php
}
?>
 * UsingDbApiWithPostgres

=== Talks ===

 * [[https://www.egenix.com/library/presentations/EuroPython2008-Using-the-Python-Database-API/|Talk video and slides: Using the Python Database API]]

 * [[https://www.zope.de/tagung/Dresden_2010/Python-Datenbankprogrammierung_mal.pdf|Slides: Datenbankprogrammierung mit dem Python Database API]] (in German)
=== Future development ===

 * DbApi3 -- discussion of possible topics for a DB-API 3.
 * ExtendingTheDbApi

=== Historical development ===

 * [[https://python.domainunion.de/dev/peps/pep-0248/|PEP 248: Python Database API Specification v1.0]].

== Related tools ==

  * HigherLevelDatabaseProgramming -- wrappers that provide simpler or higher-level database interfaces, such as object/relational mappers and SQL generators.

  * [[https://sqlrelay.sourceforge.net/|SQL Relay]] is a persistent database connection pooling, proxying and load balancing system for Unix systems, supporting many different databases and languages, including PostgreSQL and Python.

== Other resources ==

  * DatabaseBooks -- lists a few recommended titles for learning about databases. These books aren't Python-specific.

  * [[https://dmoz.org/Computers/Programming/Databases/|Programming:Databases]] category on dmoz.org

== Non-relational Databases ==

  * PersistenceTools -- describes non-relational tools for storing data on disk.

  * XmlDatabases

  * [[https://www.matisse.com/product_information/language_bindings/lang_python.html|Matisse Software]] provides Python bindings for their object database.
  * [[https://sarkarinaukriindia.info|sarkari naukri]]

Starting point for learning about using databases from Python.

Relational Databases

Relational databases are the most widely used type of database, storing information as tables containing a number of rows.

  • DatabaseInterfaces -- List of available Python databases interfaces. This also helps you choose the right database for your application.

The DB-API

The DB-API is a specification for a common interface to relational databases. The current version of the specification is version 2.0.

Talks

Future development

Historical development

  • HigherLevelDatabaseProgramming -- wrappers that provide simpler or higher-level database interfaces, such as object/relational mappers and SQL generators.

  • SQL Relay is a persistent database connection pooling, proxying and load balancing system for Unix systems, supporting many different databases and languages, including PostgreSQL and Python.

Other resources

Non-relational Databases

DatabaseProgramming (last edited 2011-11-26 09:05:05 by MarcAndreLemburg)

Unable to edit the page? See the FrontPage for instructions.