473,769 Members | 7,320 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

pysqlite smart search

14 New Member
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 1274

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

Similar topics

8
2481
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 machine... and, of course, spending time on their very busy mailing list. :-) I didn't find any mention of Ubuntu in a quick scan of recent messages, so... Ubuntu is a Linux distribution that starts with the breadth of Debian and adds regular...
0
1304
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
2068
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 connection, I get "SQL statements in progress errors". Seems ok to me, you can't do that. So, next step: Both parts get a separate connection. Now I get "Database locked" errors. Hmm, yes, it's GUI stuff after all, being all in the same
6
4393
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 avail. Build and install appear to go smoothly but attempting to run the tests from the python interpreter fails. Likewise any attempt to utilise pysqlite2 in a python script fails.
1
2275
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 c:\programme\python24\lib\site-packages\turbogears-1.0.1- py2.4.egg Processing dependencies for TurboGears>=1.0
14
7157
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 error message is longer than what I send here. % easy_install pysqlite Searching for pysqlite Reading http://cheeseshop.python.org/pypi/pysqlite/ Reading http://pysqlite.org/
5
2330
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 features. Go to http://pysqlite.org/ for downloads, online documentation and
4
3280
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 I get: $ easy_install pysqlite Searching for pysqlite Reading http://pypi.python.org/simple/pysqlite/ Reading http://pysqlite.org/ Reading http://initd.org/pub/software/pysqlite/releases/2.3/2.3.3/ Reading http://pysqlite.sourceforge.net/
15
14782
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 directory". So, I assume that the absence of the "sqlite3.h" is the origin of the problem. I found on the web, that this file should be either in "/usr/local/ include" or in "/usr/local/lib". I check this directories and I really
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10216
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9997
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9865
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8873
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3565
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.