Popular recipes tagged "sqlite"http://code.activestate.com/recipes/tags/sqlite/popular/2016-09-29T18:04:57-07:00ActiveState Code RecipesPut Peewee ORM data to PDF with xtopdf (Python)
2016-09-29T18:04:57-07:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/580704-put-peewee-orm-data-to-pdf-with-xtopdf/
<p style="color: grey">
Python
recipe 580704
by <a href="/recipes/users/4173351/">Vasudev Ram</a>
(<a href="/recipes/tags/conversion/">conversion</a>, <a href="/recipes/tags/converter/">converter</a>, <a href="/recipes/tags/database/">database</a>, <a href="/recipes/tags/formats/">formats</a>, <a href="/recipes/tags/orm/">orm</a>, <a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/pdf_generation/">pdf_generation</a>, <a href="/recipes/tags/peewee/">peewee</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/python2/">python2</a>, <a href="/recipes/tags/sqlite/">sqlite</a>, <a href="/recipes/tags/xtopdf/">xtopdf</a>).
</p>
<p>This recipe shows how some basics of how to fetch data from database tables managed by the Peewee ORM (a lightweight expressive ORM for Python) and write that data, formatted, to a PDF file. The recipe uses Python, the Peewee ORM and the xtopdf toolkit for PDF creation.</p>
Publish SQLite data to PDF using named tuples (Python)
2015-02-24T22:08:11-08:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/579027-publish-sqlite-data-to-pdf-using-named-tuples/
<p style="color: grey">
Python
recipe 579027
by <a href="/recipes/users/4173351/">Vasudev Ram</a>
(<a href="/recipes/tags/conversion/">conversion</a>, <a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/pdfwriter/">pdfwriter</a>, <a href="/recipes/tags/sql/">sql</a>, <a href="/recipes/tags/sqlite/">sqlite</a>, <a href="/recipes/tags/sqlite3/">sqlite3</a>, <a href="/recipes/tags/xtopdf/">xtopdf</a>).
</p>
<p>This recipe shows how to publish SQLite data to PDF, using named tuples from the collections module of Python, the sqlite3 library, and the xtopdf library for PDF generation.</p>
A wxPython GUI To Create Sqlite3 Databases (Python)
2013-09-18T23:05:51-07:00toufic zaarourhttp://code.activestate.com/recipes/users/4187866/http://code.activestate.com/recipes/578665-a-wxpython-gui-to-create-sqlite3-databases/
<p style="color: grey">
Python
recipe 578665
by <a href="/recipes/users/4187866/">toufic zaarour</a>
(<a href="/recipes/tags/gui/">gui</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/sqlite/">sqlite</a>, <a href="/recipes/tags/wxpython/">wxpython</a>).
Revision 2.
</p>
<p>A GUI built around wxPython in a way that will allow you to add to this application other forms and functionalities. The main DialogBox is to create,in a fast way, Sqlite3 databases that are used for web or applications development. In order to work properly, save the script in a separate directory.There is also more; each time you create a database a text file named "CreationLog.txt" will be created (for the first time you use the application or if it is not there) and updated, describing when and where was your database created and with what SQL query. I am pleased to receive all the suggestions and improvements on this site or to my e-mail directly if this is convenient to you.</p>
Python DBAPI 2 "qmark" to "named" paramstyle (Python)
2012-12-14T19:39:04-08:00Steve Howehttp://code.activestate.com/recipes/users/4184602/http://code.activestate.com/recipes/578380-python-dbapi-2-qmark-to-named-paramstyle/
<p style="color: grey">
Python
recipe 578380
by <a href="/recipes/users/4184602/">Steve Howe</a>
(<a href="/recipes/tags/dbapi/">dbapi</a>, <a href="/recipes/tags/named/">named</a>, <a href="/recipes/tags/paramstyle/">paramstyle</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/qmark/">qmark</a>, <a href="/recipes/tags/sqlite/">sqlite</a>, <a href="/recipes/tags/sqlite3/">sqlite3</a>).
</p>
<p>Allows to use "named"-style params with drivers that support only "qmark"-style, as sqlite3.</p>
Android Gmail: export messages from SQLite database blobs (Python)
2013-03-22T11:45:11-07:00ccpizzahttp://code.activestate.com/recipes/users/4170754/http://code.activestate.com/recipes/578106-android-gmail-export-messages-from-sqlite-database/
<p style="color: grey">
Python
recipe 578106
by <a href="/recipes/users/4170754/">ccpizza</a>
(<a href="/recipes/tags/android/">android</a>, <a href="/recipes/tags/sqlite/">sqlite</a>).
Revision 5.
</p>
<p>This script will extract email message bodies from the SQLite database stored in an android phone.</p>
<p>The gmail database is typically located on your phone under the following location:</p>
<pre class="prettyprint"><code>`\data\data\com.google.android.gm\databases\mailstore.YOURUSERNAME@gmail.com.db`
</code></pre>
<p>To use the script, copy the file above from your phone to your machine and rename it to <code>gmail.db</code>.</p>
<p><em>NOTE:</em> You need a rooted phone in order to get access to the folder above.</p>
Using SQLite as an embedded database with C# instantly (Text)
2010-12-15T01:24:06-08:00Stephen Akikihttp://code.activestate.com/recipes/users/4172143/http://code.activestate.com/recipes/577500-using-sqlite-as-an-embedded-database-with-c-instan/
<p style="color: grey">
Text
recipe 577500
by <a href="/recipes/users/4172143/">Stephen Akiki</a>
(<a href="/recipes/tags/akiscode/">akiscode</a>, <a href="/recipes/tags/csharp/">csharp</a>, <a href="/recipes/tags/database/">database</a>, <a href="/recipes/tags/embedded/">embedded</a>, <a href="/recipes/tags/sqlite/">sqlite</a>).
</p>
<p><a href="http://akiscode.com/articles/sqlite-csharp.shtml" rel="nofollow">http://akiscode.com/articles/sqlite-csharp.shtml</a></p>
<p>There are a few libaries that every programmer loves and knows because they either:</p>
<ul>
<li>Saves you a ton of time coding</li>
<li>Does something that you don't know how to do yourself</li>
</ul>
<p>Examples include cURL, SQLite, or even the .NET library itself. Many of us have to create CRUD (Create, Read, Update, Delete) projects on a semi-regular routine. SQLite is nice in the fact that it handles all the CRUD-y stuff (bad pun I know) in a simple, small and standalone package. But because SQLite is so nice to use (when compared to say XML), the Gods have cursed SQLite to cause many headaches if you are a new to it on C# to balance the world karma (or something like that). Also note that i'm not going to explain what any of the code does as its pretty self explanatory. Anyway, here is a complete example on how to setup an embedded SQLite database, insert some data into it, and then update a listview with only certain columns from the database:</p>
<p><strong>The Fun Stuff</strong></p>
<ol>
<li><p><em>*NOTE: I've made a demo project that you can download <a href="http://akiscode.com/articles/Akiscode-SQLiteTest.zip">here</a>. It includes the DLLs and everything that i've talked about below. *</em></p></li>
<li><p>Download the setup from <a href="http://sqlite.phxsoftware.com/">these guys</a> and install it.</p></li>
<li><p>Start a new Project in Visual C# Studio (I'm using version 2010 Express). Make it a Windows Forms Application. Save it anywhere. For this example, I will save it on the Desktop and call the project "Akiscode-SQLiteTest. At the time I was doing this, the SQLite dll only worked with a program targeted at .NET version 3.5. To learn how to change that go <a href="http://msdn.microsoft.com/en-us/library/bb772098(v=vs.90).aspx">here</a>.</p></li>
<li><p>Go to the Solutions Explorer on the top right of your VC setup. Right click references and select "Add Reference". Go to the ".NET" tab and find the entry named "System.Data.SQLite". Not "System.Data.Sql", not "System.Data.SqlXml", NOT "MySql.Data". Just find "System.Data.SQLite". If you can't find it, sort the list by name. If you still can't find it, restart VC and try this process again. Still can't find it? Run the installer and do it all over again. Still not there? Well I can't really help you, hand in your programming badge on the way out.</p></li>
<li><p>Once you added "System.Data.SQLite", right click it and select properties. Set "Copy Local" to true.</p></li>
<li><p>Ok type at the top "using "using System.Data.SQLite;" without the quotes.</p></li>
<li><p>Go back to the form designer. Add a listview component. In the properties window (bottom right) make sure the property view is set to "Details". Then right click on the listview and add columns. For this example I added two called "First Name" and "Last Name"</p></li>
</ol>
<p>8.Ok now for some copy and paste coding (my favorite): Double click the form to make a "Form1_Load" function appear and paste the following in it:</p>
sqlite message bus (Python)
2010-01-11T09:36:21-08:00André Bjärbyhttp://code.activestate.com/recipes/users/97994/http://code.activestate.com/recipes/577001-sqlite-message-bus/
<p style="color: grey">
Python
recipe 577001
by <a href="/recipes/users/97994/">André Bjärby</a>
(<a href="/recipes/tags/message_bus/">message_bus</a>, <a href="/recipes/tags/sqlite/">sqlite</a>).
</p>
<p>Let several (unix) processes communicate via a shared sqlite database.</p>
firefox sqlite files cleaner (Python)
2009-07-18T21:41:13-07:00peekaahttp://code.activestate.com/recipes/users/2919471/http://code.activestate.com/recipes/576842-firefox-sqlite-files-cleaner/
<p style="color: grey">
Python
recipe 576842
by <a href="/recipes/users/2919471/">peekaa</a>
(<a href="/recipes/tags/firefox/">firefox</a>, <a href="/recipes/tags/sqlite/">sqlite</a>).
Revision 7.
</p>
<p>Walks through the all the Firefox profiles in current user account and cleans all
*.sqlite files with "vacuum". It makes firefox faster then often. Should work on Linux, too, when properly changed constants.</p>
<p>For: python 2.6 (2.5+sqlite3), FF 3.5</p>
firefox sqlite files cleaner (linux) (Python)
2009-07-15T12:15:20-07:00Vince Spicerhttp://code.activestate.com/recipes/users/4171124/http://code.activestate.com/recipes/576843-firefox-sqlite-files-cleaner-linux/
<p style="color: grey">
Python
recipe 576843
by <a href="/recipes/users/4171124/">Vince Spicer</a>
(<a href="/recipes/tags/firefox/">firefox</a>, <a href="/recipes/tags/sqlite/">sqlite</a>).
Revision 3.
</p>
<p>Modified from <a href="http://code.activestate.com/recipes/576842/">Recipe 576842</a> to support linux</p>
<p>Walks through the all the Firefox profiles in current user account and cleans all *.sqlite files with "vacuum". It makes firefox faster then often. </p>
<p>tested on Ubuntu</p>
<p>For: python 2.6 (2.5+sqlite3), FF 3.5</p>
MultiThread support for SQLite access. (Python)
2010-07-20T14:29:35-07:00Louis RIVIEREhttp://code.activestate.com/recipes/users/4035877/http://code.activestate.com/recipes/526618-multithread-support-for-sqlite-access/
<p style="color: grey">
Python
recipe 526618
by <a href="/recipes/users/4035877/">Louis RIVIERE</a>
(<a href="/recipes/tags/database/">database</a>, <a href="/recipes/tags/sqlite/">sqlite</a>, <a href="/recipes/tags/threads/">threads</a>).
Revision 4.
</p>
<p>Workaround for the SQLite limitation that prevents multiple threads from sharing a Connection object.</p>