title: How to open an SQLite database readonly in Julia?
body: <p>I'd like to read my Safari history database from a Julia script (Mac OS X).</p>
  <p>I have a command line script that works:</p>
  <pre><code>sqlite3 -readonly ~/Library/Safari/History.db 'SELECT v.title, i.url FROM history_items i, history_visits v WHERE i.url LIKE &quot;%en.wikipedia.org%&quot; AND i.id=v.history_item AND v.title LIKE &quot;%- Wikipedia%&quot; GROUP BY v.title ORDER BY v.visit_time' 
  </code></pre>
  <p>... but trying it in Julia (in Juno / Atom) gives me a permission error</p>
  <pre><code>db = SQLite.DB(&quot;/Users/grimxn/Library/Safari/History.db&quot;)
  sql = &quot;&quot;&quot;
      SELECT v.title, i.url, v.visit_time
      FROM history_items i, history_visits v
      WHERE i.url LIKE &quot;%en.wikipedia.org%&quot;
          AND i.id=v.history_item
          AND v.title LIKE &quot;%- Wikipedia%&quot;
      GROUP BY v.title
      ORDER BY v.visit_time
  &quot;&quot;&quot;
  result = DBInterface.execute(db, sql) |&gt; DataFrame
  (rows, cols) = size(result)
  println(&quot;Result has $(rows) rows&quot;)
  println(&quot;Earliest: $(result[1,1])&quot;)
  println(&quot;Latest: $(result[rows,1])&quot;)
  </code></pre>
  <blockquote>
  <p>ERROR: LoadError: SQLite.SQLiteException(&quot;unable to open database file&quot;)</p>
  </blockquote>
  <p>Now, when I copy the database to my home directory, and swap</p>
  <pre><code>db = SQLite.DB(&quot;/Users/grimxn/Library/Safari/History.db&quot;)
  </code></pre>
  <p>to</p>
  <pre><code>db = SQLite.DB(&quot;/Users/grimxn/History.db&quot;)
  </code></pre>
  <p>everything works, so I <em>guess</em> it is that the Julia / Juno process has only got read permissions, but is accessing the db read/write.</p>
  <p>How do I attach to the database as readonly in Julia?</p>