<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>mFabrik - mobile sites, apps, HTML5 and CMS software development &#187; sqlite</title>
	<atom:link href="http://blog.mfabrik.com/tag/sqlite/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.mfabrik.com</link>
	<description>Freedom delivered.</description>
	<lastBuildDate>Wed, 03 Aug 2011 09:47:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Mirroring App Engine production data to development server using appcfg.py</title>
		<link>http://blog.mfabrik.com/2011/03/14/mirroring-app-engine-production-data-to-development-server-using-appcfg-py/</link>
		<comments>http://blog.mfabrik.com/2011/03/14/mirroring-app-engine-production-data-to-development-server-using-appcfg-py/#comments</comments>
		<pubDate>Sun, 13 Mar 2011 21:14:46 +0000</pubDate>
		<dc:creator>Mikko Ohtamaa</dc:creator>
				<category><![CDATA[appengine]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[app engine]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[mirror]]></category>
		<category><![CDATA[remote api]]></category>
		<category><![CDATA[sqlite]]></category>
		<category><![CDATA[upload]]></category>

		<guid isPermaLink="false">http://blog.mfabrik.com/?p=1105</guid>
		<description><![CDATA[Google App Engine provides some remote API functionality out of the box. One of the remote API features  is to download data from the development server. After downloading, then you can upload the downloaded data to your development server, effectively mirroring the content of the production server to your local development server. This is very [...]]]></description>
			<content:encoded><![CDATA[<p>Google App Engine provides some <a href="http://code.google.com/appengine/docs/python/tools/uploadingdata.html#Setting_Up_remote_api">remote API functionality out of the box</a>. One of the remote API features  is to download data from the development server. After downloading, then you can upload the downloaded data to your development server, effectively mirroring the content of the production server to your local development server. This is very useful if you are working CMS, sites, etc. where you want to test new layout or views locally against the old data before putting them to the production.</p>
<p>First enable remote API in <em>app.yaml</em>:</p>
<pre>- url: /remote_api
  script: $PYTHON_LIB/google/appengine/ext/remote_api/handler.py
  login: admin</pre>
<blockquote><p>Note: Using <em>builtins</em> app.yaml directive didn&#8217;t work for me some reason, so I had to specify remote API URI manually.</p></blockquote>
<p>After this you should be able <a href="http://code.google.com/appengine/docs/python/tools/uploadingdata.html#Downloading_and_Uploading_All_Data">to download data</a>. Here I am using <em>appcfg.py</em> global installation on OSX. Below is the command and sample output.</p>
<pre>appcfg.py -e yourgoogleaccount@gmail.com download_data --url=http://yourappid.appspot.com/remote_api --filename=data.sqlite3
...
Downloading data records.
[INFO    ] Logging to bulkloader-log-20110313.222523
[INFO    ] Throttling transfers:
[INFO    ] Bandwidth: 250000 bytes/second
[INFO    ] HTTP connections: 8/second
[INFO    ] Entities inserted/fetched/modified: 20/second
[INFO    ] Batch Size: 10
...
[INFO    ] Have 1803 entities, 0 previously transferred
[INFO    ] 1803 entities (972883 bytes) transferred in 91.0 seconds</pre>
<p>data.sqlite3 is your production database dump in SQLite 3 binary format (used internally by the development server).</p>
<p>If you have sqlite command line tool installed you can explore around the data dump there:</p>
<pre>sqlite3 data.sqlite
SQLite version 3.7.5
Enter ".help" for instructions
Enter SQL statements terminated with a ";"

sqlite&gt; .tables
Apps                                   your-app!Model1!Entities
IdSeq                                  your-app!Model1!EntitiesByProperty
Namespaces                             your-app!Model2!Entities
bulkloader_database_signature          your-app!Model2!EntitiesByProperty
your-app!!Entities                     result
your-app!!EntitiesByProperty</pre>
<p>Now you can upload data.</p>
<blockquote><p><em>Note: </em>Even though there exists option &#8211;use_sqlite for dev_appserver.py looks like it cannot directly use the database file produced by download_data. You cannot just swap database files, you need upload the downloaded data to the development server.</p></blockquote>
<p>Start your development server:</p>
<pre>dev_appserver.py .</pre>
<p>In another terminal, go to downloaded data.sqlite folder and give the command:</p>
<pre>appcfg.py upload_data --url http://localhost:8080/remote_api --file=data.sqlite --application=yourappid</pre>
<p>It will ask you for credentials, but it seems that any username and password is accepted for the local development server.</p>
<p>Now you can login to your local development server to explore the data:</p>
<pre>http://localhost:8080/_ah/admin</pre>
<p>Ensure your data got copied over using Data Viewer:</p>
<pre>http://localhost:8080/_ah/admin</pre>
<p class="signature">
<a href="http://mfabrik.com/@@zoho-contact-form"><img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/mfabrik-24.png"></a> <a href="http://mfabrik.com/@@zoho-contact-form">Get developers</a> <a href="http://feeds.feedburner.com/mFabrikWebAndMobileDevelopment" rel="alternate" type="application/rss+xml"><img valign="middle" src="http://www.feedburner.com/fb/images/pub/feed-icon16x16.png" alt="" style="vertical-align:middle;border:0"/></a> <a href="http://feeds.feedburner.com/mFabrikWebAndMobileDevelopment" rel="alternate" type="application/rss+xml">Subscribe mFabrik blog in a reader</a> <a href="http://twitter.com/mfabrik"> <img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/twitter-24.png"></a> <a href="http://twitter.com/moo9000">Follow me on Twitter</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mfabrik.com/2011/03/14/mirroring-app-engine-production-data-to-development-server-using-appcfg-py/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Flex 3 SQLite and the mystery of &#8220;text value to numeric value&#8221;</title>
		<link>http://blog.mfabrik.com/2008/03/14/a-short-story-about-why-to-rtfm/</link>
		<comments>http://blog.mfabrik.com/2008/03/14/a-short-story-about-why-to-rtfm/#comments</comments>
		<pubDate>Fri, 14 Mar 2008 19:13:29 +0000</pubDate>
		<dc:creator>saarni</dc:creator>
				<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[Flex 3]]></category>
		<category><![CDATA[sqlite]]></category>
		<category><![CDATA[rtfm]]></category>
		<category><![CDATA[timestamp]]></category>

		<guid isPermaLink="false">http://blog.redinnovation.com/2008/03/14/a-short-story-about-why-to-rtfm/</guid>
		<description><![CDATA[Learning new development environments and languages can be quite fun, but sometimes it turns out just plain frustrating. Especially so if you are trying to learn something that is still in its beta stage. This time it was Adobe AIR and Flex 3. The program in question required storing date and time values in an [...]]]></description>
			<content:encoded><![CDATA[<p>Learning new development environments and languages can be quite fun, but sometimes it turns out just plain frustrating. Especially so if you are trying to learn something that is still in its beta stage. This time it was Adobe AIR and Flex 3.</p>
<p>The program in question required storing date and time values in an sqlite3 database. Now, as the title of this entry says, I should&#8217;ve just read the AIR sqlite handling manual 1 more time (or 2-10 more times) and I could&#8217;ve learnt that AIR SQL handling accepts &#8220;Date&#8221; as column type and handles inserting and getting Date objects from the database transparently. I did not notice this while studying and used &#8220;TIMESTAMP&#8221; as column type instead. This is where things went wrong&#8230; so wrong&#8230;</p>
<p>Using &#8220;TIMESTAMP&#8221; column type and inserting datetime strings worked flawlessly in the betas along with using sqlite date functions. But AIR 1.0 release came and suddenly my application started producing the following SQL errors everywhere:</p>
<p><code>SQLError: 'Error #3115: SQL Error.', details:'could not convert text value to numeric value.', operation:'execute'</code></p>
<p>Naturally for a few days I went through my SQL code and tables trying different things on columns that had types like &#8220;INTEGER&#8221;, &#8220;REAL&#8221;, &#8220;NUMERIC&#8221; and so on. After trying and trying I finally decided to read the AIR documentation again. The essential part turned out to be how AIR handles the column affinities in the release version: everything not recognized by AIR is given &#8220;NUMERIC&#8221; column affinity. This and the fact that AIR is now stricter about types is what changed between the betas and release version and broke the columns with &#8220;TIMESTAMP&#8221; as type since I was trying to insert text.</p>
<p>So, again, I should&#8217;ve just rtfm&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mfabrik.com/2008/03/14/a-short-story-about-why-to-rtfm/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>

