473,322 Members | 1,523 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

pysqlite smart search

14
Hey guys;

I am trying to develop a tiny program using python to search inside sqlite database with file extension is .db in which the program will ask users to enter their search query and base on that it will retrieve the result But

I need the program to have some smartness in search mechanism in which the program will guess that the user is looking for these key words in the database.

so far i came up with this but the search ain't smart, i have to write the full key word in order to retrieve specific information.
Expand|Select|Wrap|Line Numbers
  1. from pysqlite2 import dbapi2 as sqlite3
  2.  
  3. connection = sqlite3.connect('Photos.db')
  4. memoryConnection = sqlite3.connect(':memory:')
  5. cursor = connection.cursor()
  6. prompt = 'Enter your search query?\n'
  7. keyword = raw_input(prompt)
  8. if cursor.execute('SELECT * FROM photos WHERE Tag LIKE ?',[keyword]):
  9.     print cursor.fetchall()
  10. else:
  11.     cursor.execute('SELECT * FROM photos WHERE Date LIKE ?', [keyword])
  12.     print cursor.fetchall()
Any ideas and
thanks in advance
Feb 23 '09 #1
0 1250

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Martin Maney | last post by:
Apologies if this isn't news here - I've been too busy this last week or so for even skimming the traffic here, in part because I've been messing around with Ubuntu's preview release on a spare...
0
by: Jonathan Fine | last post by:
I'd appreciate comments on what I'm doing. Please be kind, I'm a new kid on the block. Here's my application. I'm writing some test code. (I'm a recent convert to unit testing.)
2
by: F. GEIGER | last post by:
In my wxPython-app a part of it gathers data, when a button is pressed, and stores it into a db. The GUI part should display the stuff being stored in the db. When both parts work on the same...
6
by: Rob Cowie | last post by:
Hi all, I'm having difficulty installing pysqlite 2.1.3 on Mac OS X 10.4.4 There are some notes on the pysqlite wiki regarding modification of the setup.py script and I've followed them to no...
1
by: Thomas | last post by:
Hi there! Installing TurboGears out-of-the-box (egg-based) on Windows doesn't work because I can't compile the extensions needed for the required pysqlite (also egg- based): Installed...
14
by: Nader Emami | last post by:
I have installed "TurboGears" and I would install 'pysqlite' also. I am a user on a Linux machine. If I try to install the 'pysqlite' with 'easy_install' tool I get the next error message. The...
5
by: =?ISO-8859-1?Q?Gerhard_H=E4ring?= | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 pysqlite 2.5.0 released ======================= I'm pleased to announce the availability of pysqlite 2.5.0. This is a release with major new...
4
by: Tilman Kispersky | last post by:
I am trying to install sqlite for use with python on cygwin. I have installed the sqlite packages from cygwin (that is libsqlite3-devel and libsqlite3_0). When attempting to easy_install pysqlite...
15
by: Kurda Yon | last post by:
Hi, I try to "build" and "install" pysqlite? After I type "python setup.py build" I get a lot of error messages? The first error is "src/ connection.h:33:21: error: sqlite3.h: No such file or...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.