sqlite3

create a indexed column in sqlite

Can I create index on a column in the create table command in sqlite? I tried this command below in sqlite3 in Android shell. It seems to work. sqlite> create table mytest (id integer indexed); sqlite> .schema CREATE TABLE mytest (id integer indexed); But, in sqlite's query language specification, specifying a column to be indexed is...

Excel/SQLite date serial numbers

How can I get SQLite to convert excel-type serial numbers to dates, e.g. I want the integer 40074 in a table to somehow get the date 18-Sept-2009? The dates are already in SQLite. ...

Create sqlite3 database at prompt

I tried using the following commands to create a database file at prompt, but none of them would work. $ sqlite3 test.db sqlite3 test.db test.db does it require a semi-colon at the end or is it that hard to create a database file using sqlite3 prompt? Edit: When I start the sqlite3 prompt, I get SQLite version 3.6.22 Enter ".help" ...

Android & SQLite: "Table audios has no column named downloaded"

I get this weird exception when i run my app on both the emulator and a USB connected device. i can see the table inside the shell, but when I try to insert a record from the Activity acton I get this exception: android.database.sqlite.SQLiteException: table audios has no column named downloaded I am mostly running on an emulator with...

ActiveRecord/sqlite3 column type lost in table view?

I have the following ActiveRecord testcase that mimics my problem. I have a People table with one attribute being a date. I create a view over that table adding one column which is just that date plus 20 minutes: #!/usr/bin/env ruby %w|pp rubygems active_record irb active_support date|.each {|lib| require lib} ActiveRecord::Base.estab...

SQLite3 database doesn't actually insert data - iPhone

I'm trying to add a new entry into my database, but it's not working. There are no errors thrown, and the code that is supposed to be executed after the insertion runs, meaning there are no errors with the query. But still, nothing is added to the database. I've tried both prepared statements and the simpler sqlite3_exec and it's the ...

How do I reference sqlite db column to use in update statement

I am trying to update a datetime column in an android sqlite db to use international date format (yyyy-mm-dd) instead of the current format (mm/dd/yyyy). I want to use the sqlite date() function to reformat the current value of the column. I thought it would be as simple as the following: update tblename set thedate = date(thedate) but...

Navigating cursor rows in SQLite

Hi there, I am trying to understand how the following builtin functions work when sequentially processing cursor rows. The descriptions come from the Python 3.1 manual (using SQLite3) Cursor.fetchone() Fetches the next row of a query result set, returning a single sequence. Cursor.fetchmany() Fetches the next set of rows of a query r...

What is the proper location for a sqlite3 database file?

Hi, Everyone: I'm using a sqlite3 database to store app's data. Instead of building a database within program, I introduced an existing db file: 'abc.sqlite' into my project and put it under my 'Resources' folder. So, I think this db file should be inside of 'bundle', so at my init function, I used following statement to read it out: N...

OperationalError "unable to open database file" processing query results with SQLAlchemy and SQLite3

I'm running into this little problem that I hope is just a dumb user error. It looks like some sort of a size limit with a query to a SQLite database. I managed to reproduce the issue with an in-memory DB and a simple script shown below. I can make it work by either reducing the number of records in the DB; or by reducing the size of eac...

Can I get the raw SQL generated by a prepared statement in Python’s sqlite3 module?

If so, how can I do this? ...

A rails migration that specifies the distance between two months..?

I would like to make two drop downs. a start time, and an end time. Specifically, I only need months. I would like to, for example, choose January, and then March, and then have the database read that it is the these two months plus February. Is there any out of the box migration that could work? I'm guessing.. script/generate migrat...

Is there are standard way to store a database schema outside a python app

I am working on a small database application in Python (currently targeting 2.5 and 2.6) using sqlite3. It would be helpful to be able to provide a series of functions that could setup the database and validate that it matches the current schema. Before I reinvent the wheel, I thought I'd look around for libraries that would provide som...

How can I create a sequence in SQLite?

I have create a table in sqlite. there is two fields pk_categoryid,category_name. I want to enter only one value from user side. so how can I create sequence ...

sqlite use in tcl script over nfs (or.. how to make standalone sqlite3 which can be run over nfs)

I want to use an embed an sqlite database into an existing tcl application (migrated from flat-file). Currently; our tcl interpreter is run from a network location; <nfs share>/bin/tclsh8.3 I do have an nfs $PATH for executables set for all users already; I am assuming I can place a standalone sqlite3 executible there; though I have b...

Inserting rows while fetching(from another table) in SQLite

I'm getting this error no matter what with python and sqlite. File "addbooks.py", line 77, in saveBook conn.commit() sqlite3.OperationalError: cannot commit transaction - SQL statements in progress The code looks like this: conn = sqlite3.connect(fname) cread = conn.cursor() cread.execute('''select book_text from table'''...

How do I fix this Django error "Exception Type: OperationalError Exception Value: no such table?"

I've finally installed all the requirements (so i think!) of a Django project, and I'm trying to get a local install running on my Mac (OSX 10.4). I'm getting the following error: Blockquote OperationalError at / no such table: django_content_type Request Method: GET Request URL: http://127.0.0.1:8000/ Exception Type: O...

Nested joins hide table names

Hi: I have three tables: Suppliers, Parts and Types. I need to join all of them while discriminating columns with the same name (say, "id") in the three tables. I would like to successfully run this query: CREATE VIEW Everything AS SELECT Suppliers.name as supplier, Parts.id, Parts.description, Types.typedesc as...

Fetch DB File From Server and use the SQL C API to work with file at run-time.

I realize that I can't write to the app bundle at runtime. I had originally thought I could simply download a file to the application bundle which would in turn be read by my application. NSURL *url = [NSURL URLWithString:@"http://www.drewcarpenter.info/shopping.db"]; ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url]; [re...

Update a column based on a field from another table

Hi: I'd like to update values in one table based on corresponding values from other tables. Say you want to update prices of pieces provided by one specific manufacturer whose name is in the table Manufacturers with the Pieces table containing only the id of the manufacturer. I've seen several solutions for MySQL here and for MS SQL Se...