Difference between revisions of "Scripter/Databases"

From Scribus Wiki
Jump to navigation Jump to search
(added Scripting Index)
 
(3 intermediate revisions by one other user not shown)
Line 2: Line 2:
  
 
= Scripter and relational databases =
 
= Scripter and relational databases =
 +
 +
You can use Scribus scripting to populate documents with content from a database.
  
 
There are no specialities with using databases in the Scribus Scripter. You could use DB as in normal standalone script or application.
 
There are no specialities with using databases in the Scribus Scripter. You could use DB as in normal standalone script or application.
  
 
[http://www.python.org/peps/pep-0249.html PEP-0249] - Python database API v.2.
 
[http://www.python.org/peps/pep-0249.html PEP-0249] - Python database API v.2.
 +
 +
== Python Database Module ==
  
 
There are various [http://www.python.org/topics/database/modules.html modules] for database access.
 
There are various [http://www.python.org/topics/database/modules.html modules] for database access.
Remember that the module '''must be''' instaled in/with the Python version which is used/compiled in Scribus!
+
Remember that the module '''must be''' installed in/with the Python version which is used/compiled in Scribus!
I've tested personaly with 100% success: DCOracle2 and MySQLdb.
+
 
 +
== Available Database Engines ==
 +
 
 +
I've tested personaly with 100% success: DCOracle2 and MySQL
 +
 
 +
For standard use cases one may try SQLite ([http://wiki.python.org/moin/SQLite Python DBDriver], [http://www.sqlite.org/about.html About SQLite]), a self-contained, serverless, zero-configuration, transactional SQL database engine. It may simplify your script development.
 +
 
 +
== Example ==
  
== An Example ==
+
* There is an common database example since 1.2.2 and 1.3cvs versions - see. SCRIBUSROOT/share/scribus/samples/sample_db_usage.py docstring (e.g. via ''Script/About Script...'' menu) or script content. You'll need to set right connection parameters in the script file.
  
There is an common database example since 1.2.2 and 1.3cvs versions - see. SCRIBUSROOT/share/scribus/samples/sample_db_usage.py docstring (e.g. via ''Script/About Script...'' menu) or script content.
+
* Alternatively, you can import csv data. See http://wiki.scribus.net/canvas/Import_CSV_Data
You'll need to set right connection parameters in the script file.
 

Latest revision as of 13:57, 27 November 2014

This article is part of the Scripts series.

Scripter and relational databases

You can use Scribus scripting to populate documents with content from a database.

There are no specialities with using databases in the Scribus Scripter. You could use DB as in normal standalone script or application.

PEP-0249 - Python database API v.2.

Python Database Module

There are various modules for database access. Remember that the module must be installed in/with the Python version which is used/compiled in Scribus!

Available Database Engines

I've tested personaly with 100% success: DCOracle2 and MySQL

For standard use cases one may try SQLite (Python DBDriver, About SQLite), a self-contained, serverless, zero-configuration, transactional SQL database engine. It may simplify your script development.

Example

  • There is an common database example since 1.2.2 and 1.3cvs versions - see. SCRIBUSROOT/share/scribus/samples/sample_db_usage.py docstring (e.g. via Script/About Script... menu) or script content. You'll need to set right connection parameters in the script file.