I hesitate to ask, but ...
I'm using Ubuntu Feisty:
* Python 2.5.1 (r251:54863, May 2 2007, 16:56:35)
[GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
* SQLite version 3.3.13
Suppose I run the following program:
import sqlite3
conn = sqlite3.connect ('example')
c = conn.cursor()
# Create table
c.execute('''cr eate table stocks
(date text, trans text, symbol text,
qty real, price real)''')
# Insert a row of data
c.execute("""in sert into stocks
values ('2006-01-05','BUY','RHAT ',100,35.14)""" )
and then I go into sqlite:
% sqlite3 example
sqlite3select * from stocks ;
It returns 0 rows. I'm in the right directory. I have experienced this
problem with some other sqlite3 database work I have done with python,
so I'm figuring there is something fishy going on. I've tried doing
similar exercises with Ruby, and they have worked OK.
Anyone else getting these problems? 13 1838
On 6/17/07, mark carter <me@privacy.net wrote:
I hesitate to ask, but ...
I'm using Ubuntu Feisty:
* Python 2.5.1 (r251:54863, May 2 2007, 16:56:35)
[GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
* SQLite version 3.3.13
Suppose I run the following program:
import sqlite3
conn = sqlite3.connect ('example')
c = conn.cursor()
# Create table
c.execute('''cr eate table stocks
(date text, trans text, symbol text,
qty real, price real)''')
# Insert a row of data
c.execute("""in sert into stocks
values ('2006-01-05','BUY','RHAT ',100,35.14)""" )
and then I go into sqlite:
% sqlite3 example
sqlite3select * from stocks ;
It returns 0 rows. I'm in the right directory. I have experienced this
problem with some other sqlite3 database work I have done with python,
so I'm figuring there is something fishy going on. I've tried doing
similar exercises with Ruby, and they have worked OK.
Anyone else getting these problems?
See http://www.python.org/dev/peps/pep-0249/ (emphasis mine):
.commit()
Commit any pending transaction to the database. *Note that
if the database supports an auto-commit feature, this must
be initially off.* An interface method may be provided to
turn it back on.
(This really should be a FAQ...)
-- David
mark carter wrote:
I hesitate to ask, but ...
Don't :-)
I'm using Ubuntu Feisty:
* Python 2.5.1 (r251:54863, May 2 2007, 16:56:35)
[GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
* SQLite version 3.3.13
Suppose I run the following program:
import sqlite3
conn = sqlite3.connect ('example')
c = conn.cursor()
# Create table
c.execute('''cr eate table stocks
(date text, trans text, symbol text,
qty real, price real)''')
# Insert a row of data
c.execute("""in sert into stocks
values ('2006-01-05','BUY','RHAT ',100,35.14)""" )
and then I go into sqlite:
% sqlite3 example
sqlite3select * from stocks ;
It returns 0 rows. I'm in the right directory. I have experienced this
problem with some other sqlite3 database work I have done with python,
so I'm figuring there is something fishy going on. I've tried doing
similar exercises with Ruby, and they have worked OK.
Anyone else getting these problems?
How about conn.commit()?
Peter
On Sun, 2007-06-17 at 12:59 +0100, mark carter wrote:
I hesitate to ask, but ...
I'm using Ubuntu Feisty:
* Python 2.5.1 (r251:54863, May 2 2007, 16:56:35)
[GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
* SQLite version 3.3.13
Suppose I run the following program:
import sqlite3
conn = sqlite3.connect ('example')
c = conn.cursor()
# Create table
c.execute('''cr eate table stocks
(date text, trans text, symbol text,
qty real, price real)''')
# Insert a row of data
c.execute("""in sert into stocks
values ('2006-01-05','BUY','RHAT ',100,35.14)""" )
and then I go into sqlite:
% sqlite3 example
sqlite3select * from stocks ;
It returns 0 rows.
Your program doesn't call conn.commit(). Python's DB-API specifies that
a connection operate in a transaction by default. The transaction is
rolled back at the end of the program if it's not committed.
--
Carsten Haese http://informixdb.sourceforge.net
David Wahler wrote:
On 6/17/07, mark carter <me@privacy.net wrote:
>Anyone else getting these problems?
See http://www.python.org/dev/peps/pep-0249/ (emphasis mine):
.commit()
OK, I tried that, and I appear to be cooking. The funny thing is, I
could have sworn that I tried that a few days ago, and it didn't work.
Weird. Appears to be working now, though, so I guess I must have been
doing something kooky.
Should I also explicitly close the cursor and connection, or is that
taken care of "automagically" ?
I'm seriously thinking about reporting the commit() thing as a doc bug
in python, as this isn't mentioned at http://docs.python.org/lib/module-sqlite3.html
and I think it's exactly the kind of thing that should be mentioned in
the examples.
On Jun 17, 7:16 am, mark carter <m...@privacy.n etwrote:
David Wahler wrote:
On 6/17/07, mark carter <m...@privacy.n etwrote:
Anyone else getting these problems?
Seehttp://www.python.org/dev/peps/pep-0249/(emphasis mine):
.commit()
OK, I tried that, and I appear to be cooking. The funny thing is, I
could have sworn that I tried that a few days ago, and it didn't work.
Weird. Appears to be working now, though, so I guess I must have been
doing something kooky.
Should I also explicitly close the cursor and connection, or is that
taken care of "automagically" ?
I'm seriously thinking about reporting the commit() thing as a doc bug
in python, as this isn't mentioned athttp://docs.python.org/lib/module-sqlite3.html
and I think it's exactly the kind of thing that should be mentioned in
the examples.
Please report the whole docs as a bug.
7stud wrote:
On Jun 17, 7:16 am, mark carter <m...@privacy.n etwrote:
>David Wahler wrote:
>>On 6/17/07, mark carter <m...@privacy.n etwrote: Anyone else getting these problems? Seehttp://www.python.org/dev/peps/pep-0249/(emphasis mine): .commit()
>> I'm seriously thinking about reporting the commit() thing as a doc bug in python, as this isn't mentioned at http://docs.python.org/lib/module-sqlite3.html and I think it's exactly the kind of thing that should be mentioned in the examples.
Please report the whole docs as a bug.
http://sourceforge.net/tracker/index...70&atid=105470
That will save a few people tearing their hair out!
On Sun, 2007-06-17 at 07:43 -0700, 7stud wrote:
Please report the whole docs as a bug.
I imagine the author appreciates constructive criticism. This is not
constructive criticism.
In other words: Pointing out specific shortcomings and ways to correct
them, such as what the OP is doing, is helpful. Calling the entire docs
a bug is not helpful.
--
Carsten Haese http://informixdb.sourceforge.net
Carsten Haese wrote:
On Sun, 2007-06-17 at 07:43 -0700, 7stud wrote:
>Please report the whole docs as a bug.
I imagine the author appreciates constructive criticism. This is not
constructive criticism.
In other words: Pointing out specific shortcomings and ways to correct
them, such as what the OP is doing, is helpful. Calling the entire docs
a bug is not helpful.
You'll be pleased to know that I was specific, and I suggested a change
that I thought would be good.
Actually, I think the docs are quite good! I went hunting around some
Scheme implementations lately. What was immediately apparent to me was
that the docs weren't nearly as good as those for python. Typical
problems centre about what modules I was supposed to load, and how I was
supposed to use them. What might be obvious to an old hand might not be
obvious to someone coming in from fresh. This is where big projects like
Python tend to score - the docs have been through many iterations.
[ Carsten Haese <ca*****@uniqsy s.com]
On Sun, 2007-06-17 at 07:43 -0700, 7stud wrote:
Please report the whole docs as a bug.
Calling the entire docs a bug is not helpful.
... unless he also comes up with the "bugfix". ;)
--
Freedom is always the freedom of dissenters.
(Rosa Luxemburg)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4 (GNU/Linux)
iD8DBQBGdX44n3I EGILecb4RAvIsAJ 0dy5Cwi9yB1Od3y 6o5SMBoj8fSxwCf UHCV
E0BFKnzSj2n8Nw1 ZhNMIGwU=
=n/jF
-----END PGP SIGNATURE----- This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Harold Shore |
last post by:
From the release notes I read that
"If you're compiling the Python source yourself, note that
the source tree doesn't include the SQLite code, only the
wrapper module. You'll need to have the SQLite libraries
and headers installed before compiling Python, and the build
process will compile the module when the necessary headers
are available."
I do have SQLite3 installed on my system, but after doing a
|
by: John Machin |
last post by:
Apologies in advance if this is a bit bloggy, but I'd like to get
comments on whether I've lost the plot (or, more likely, failed to
acquire it) before I start reporting bugs etc.
From "What's new ...":
"""
# Create table
c.execute('''create table stocks
(date timestamp, trans varchar, symbol varchar,
qty decimal, price decimal)''')
|
by: mensanator |
last post by:
Probably just me. I've only been using Access and SQL Server
for 12 years, so I'm sure my opinions don't count for anything.
I was, nevertheless, looking forward to Sqlite3. And now
that gmpy has been upgraded, I can go ahead and install
Python 2.5.
So I open the manual to Section 13.13 where I find the first
example of how to use Sqlite3:
|
by: Josh |
last post by:
Hi,
I'm running into a problem when trying to create a view in my sqlite
database in python. I think its a bug in the sqlite3 api that comes with
python 2.5.
This works as expected:
conn = sqlite3.connect(':memory:')
conn.execute("create table foo (a int,b int)")
conn.execute('create view bar as select * from foo')
|
by: cjl |
last post by:
P:
I am using python 2.5.1 on windows. I have the following code:
conn = sqlite3.connect('.\optiondata')
c = conn.cursor()
try:
c.execute('''create table options (ssymbol text, strike real,
osymbol text, bid real, mpp real, upp real)''')
except sqlite3.OperationalError:
| |
by: Simon |
last post by:
I installed the source code on unix for python 2.5.1. The install went
mainly okay, except for some failures regarding:
_ssl, _hashlib, _curses, _curses_panel.
No errors regarding sqlite3.
However, when I start python and do an import sqlite3 I get:
/ptmp/bin/python
Python 2.5.1 (r251:54863, May 29 2007, 05:19:30)
on sunos5
|
by: Josh Ritter |
last post by:
A number of our Windows customers have an issue with the sqlite3 module
included with Python 2.5.1
We've tracked the problem down to the sqlite3.dll included with the Python
2.5.1 distrubtion. It is stripped and thus cannot be relocated. This
causes the following exception on computers where something is already
loaded into the address the sqlite3.dll wants to use:
File "sqlite3\__init__.pyc", line 24, in <module>
File...
|
by: milan_sanremo |
last post by:
I have sqlite installed, but when I try to import sqlite3 I receive:
Python 2.5.1 (r251:54863, Nov 3 2007, 02:54:36) on sunos5
Type "help", "copyright", "credits" or "license" for more information.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named sqlite3
Yet:
|
by: Ben Lee |
last post by:
hi folks --
a quick python and sqlite3 performance question. i find that
inserting a million rows of in-memory data into an in-memory database
via a single executemany() is about 30% slower than using the sqlite3
CLI and the .import command (reading the same data from a disk file,
even.) i find this surprising, executemany() i assume is using a
prepared statement and this is exactly what the .import command does
(based on my quick...
|
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
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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,...
|
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...
|
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,...
|
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...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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...
| |