473,385 Members | 2,013 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,385 software developers and data experts.

Database and Interface for Python

I'm writing a couple of modules that store information about user
'behaviour'. E.g. a user accesses a certain page of a website at a
certain date-time with a certain referrer.

I need to analyse this information by different criteria. E.g. How
many users accessed the website between August 5th and August 12th,
listed by refferer !! etc It would be great to have a database engine
where I could ask these questions in just a couple of queries, rather
than having to implement all the sort/analyse functions myself.

I guess this is as bad a time as anyto start to learn to use a
database !! So I look on google and the situation is a little unclear.
I can use the database API that will give me a 'consistent
interface'... but I still need a database engine installed. e.g.
MySQL. Not only that but I need a python interface to that engine that
the database API can use ? (or I can just directly use the python
binding for whichever database I pick ?).

I think the web server I use will allow MySQL databases, so if I
install it on my windoze box and install the MySQLdb python module
then I'm well away....
Have I got it right ? Can I do 'date range' queries using MySQL,
MySQLdb and the Python database API ?

Regards,
Fuzzy

http://www.voidspace.org.uk/atlantib...thonutils.html
Jul 18 '05 #1
6 1628
Michael Foord wrote:
I'm writing a couple of modules that store information about user
'behaviour'. E.g. a user accesses a certain page of a website at a
certain date-time with a certain referrer.

I need to analyse this information by different criteria. E.g. How
many users accessed the website between August 5th and August 12th,
listed by refferer !! etc It would be great to have a database engine
where I could ask these questions in just a couple of queries, rather
than having to implement all the sort/analyse functions myself.
Yep, databases are fast, reliable and scalable for this.

I guess this is as bad a time as anyto start to learn to use a
database !! So I look on google and the situation is a little unclear.
I can use the database API that will give me a 'consistent
interface'... but I still need a database engine installed. e.g.
MySQL. Not only that but I need a python interface to that engine that
the database API can use ? (or I can just directly use the python
binding for whichever database I pick ?).
Python has a good DB interface to MySQL that works well.
I think the web server I use will allow MySQL databases, so if I
install it on my windoze box and install the MySQLdb python module
then I'm well away....
Have I got it right ? Can I do 'date range' queries using MySQL,
MySQLdb and the Python database API ?
Yes you can. Dates are stored in special format (not text) in the
database that make searching/sorting possible. You can also define
index on a date column and jump directly to a specific date (skipping
all dates you don't want to process) or range of dates.

Regards,
Fuzzy

http://www.voidspace.org.uk/atlantib...thonutils.html

Jul 18 '05 #2
Michael Foord wrote:
I need to analyse this information by different criteria. E.g. How
many users accessed the website between August 5th and August 12th,
listed by refferer !! etc It would be great to have a database engine
where I could ask these questions in just a couple of queries, rather
than having to implement all the sort/analyse functions myself.
Just simply transfer those your data to database and then retrievieng
detailed information will be simple.
I guess this is as bad a time as anyto start to learn to use a
database !! So I look on google and the situation is a little unclear.
I can use the database API that will give me a 'consistent
interface'... but I still need a database engine installed. e.g.
MySQL. Not only that but I need a python interface to that engine that
the database API can use ?
Yes, you will need both database and python interface to access it.

I think the web server I use will allow MySQL databases, so if I
install it on my windoze box and install the MySQLdb python module
then I'm well away....
Webserwer has nothing to do with database.
Have I got it right ? Can I do 'date range' queries using MySQL,
MySQLdb and the Python database API ?


Yes.

--
Maciej "Fiedzia" Dziardziel (fiedzia (at) fiedzia (dot) prv (dot) pl)
www.fiedzia.prv.pl
Jul 18 '05 #3
On 7 Oct 2004 15:11:17 -0700, fu******@gmail.com (Michael Foord)
declaimed the following in comp.lang.python:

I can use the database API that will give me a 'consistent
interface'... but I still need a database engine installed. e.g.
The "database API" is a specification of what a database
specific interface module should implement for "consistent" access. It
doesn't have a physical existence (you can't "import API").

I think the web server I use will allow MySQL databases, so if I
install it on my windoze box and install the MySQLdb python module
then I'm well away....
MySQLdb is /a/ module that implements the "database API" for
MySQL; there are many other modules that implement the "database API"
for other database engines.

Have I got it right ? Can I do 'date range' queries using MySQL,
MySQLdb and the Python database API ?
If you can do one using the command-line mysql client program,
sure... Since all you do in a DB API compliant module is generate a
string of the same SQL used in the command-line....

-- ================================================== ============ <
wl*****@ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG <
wu******@dm.net | Bestiaria Support Staff <
================================================== ============ <
Home Page: <http://www.dm.net/~wulfraed/> <
Overflow Page: <http://wlfraed.home.netcom.com/> <

Jul 18 '05 #4
[snip..]
I guess this is as bad a time as anyto start to learn to use a
database !! So I look on google and the situation is a little unclear.
I can use the database API that will give me a 'consistent
interface'... but I still need a database engine installed. e.g.
MySQL. Not only that but I need a python interface to that engine that
the database API can use ?


Yes, you will need both database and python interface to access it.

I think the web server I use will allow MySQL databases, so if I
install it on my windoze box and install the MySQLdb python module
then I'm well away....


Webserwer has nothing to do with database.


It does if it's a 'web application' your developing !! Whatever
solution I choose has to work on my server *and* on my windoze nox for
testing !!

Thanks for your answer though.

Regards,

Fuzzy

http://www.voidspace.org.uk/atlantib...thonutils.html
Have I got it right ? Can I do 'date range' queries using MySQL,
MySQLdb and the Python database API ?


Yes.

Jul 18 '05 #5
[snip..]
I guess this is as bad a time as anyto start to learn to use a
database !! So I look on google and the situation is a little unclear.
I can use the database API that will give me a 'consistent
interface'... but I still need a database engine installed. e.g.
MySQL. Not only that but I need a python interface to that engine that
the database API can use ? (or I can just directly use the python
binding for whichever database I pick ?).


Python has a good DB interface to MySQL that works well.

Am I right in thinking that is the MySQLdb python interface at
http://sourceforge.net/projects/mysql-python

This supports versions of MySQL up to 4.0.... ??

Thanks for your help.
Regards,
Fuzzy

I think the web server I use will allow MySQL databases, so if I
install it on my windoze box and install the MySQLdb python module
then I'm well away....
Have I got it right ? Can I do 'date range' queries using MySQL,
MySQLdb and the Python database API ?


Yes you can. Dates are stored in special format (not text) in the
database that make searching/sorting possible. You can also define
index on a date column and jump directly to a specific date (skipping
all dates you don't want to process) or range of dates.

Regards,
Fuzzy

http://www.voidspace.org.uk/atlantib...thonutils.html

Jul 18 '05 #6
Michael Foord wrote:

> I think the web server I use will allow MySQL databases, so if I
> install it on my windoze box and install the MySQLdb python module
> then I'm well away....


Webserwer has nothing to do with database.


It does if it's a 'web application' your developing !! Whatever
solution I choose has to work on my server *and* on my windoze nox for
testing !!


You can use (almost) any web server with any database, they are separate
components (except few non-popular integrated solutions), so your web
server will allow you to use mysql.

--
Maciej "Fiedzia" Dziardziel (fiedzia (at) fiedzia (dot) prv (dot) pl)
www.fiedzia.prv.pl
Jul 18 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: john | last post by:
Hi I am devlopeing a data centric intranetsite with data in mysql database I would like your opinion on this architecture Data will be fetched from database by python & converted into xml The...
23
by: ajikoe | last post by:
Hello I need to build table which need searching data which needs more power then dictionary or list in python, can anyone help me what kind of database suitable for python light and easy to learn....
6
by: Wolfgang Keller | last post by:
Hello, I'm looking for a spreadsheet application (MacOS X prefered, but Windows, Linux ar available as well) with support for Python scripting (third-party "plug-ins" are ok) and a database...
2
by: Moishy Gluck | last post by:
How do I open a mysql database with python. I nead a module that is compatible with windows, and will be on any regular server I singup with. if you could give me some documentation on the module...
0
by: viv.mee | last post by:
Hi, Could anybody tell me how to connect to a microsoft Access database using Python? Quick sample of code would help .. much appreciated..Thanks viv
2
by: GinTon | last post by:
EyeDB is a free ODBMS based on the ODMG 3 specification with programming interfaces for C++ and Java. It is very powerfull, mature, safe and stable. In fact, it was developed in 1992 for the Genome...
8
by: Abandoned | last post by:
Hi. I want to copy my database but python give me error when i use this command. cursor.execute("pg_dump mydata old.dump") What is the problem ? And how can i copy the database with python ?...
1
by: rsdcbabu | last post by:
hi all, Is there any interface which could return data from postgresql to python as objects so that the features of the resulting data is unchanged. for eg: returning 'date' from postgres to...
0
by: Terry Reedy | last post by:
FYI I initially parsed the subject line as "eGenix mxODBC - ODBC Database Interface" for "Python 3.0.2" and thought, "Wow, already prepared for the future" (6 months to a year) ;-). tjr
0
by: eGenix Team: M.-A. Lemburg | last post by:
On 2008-10-15 20:30, Terry Reedy wrote: It's going to look even better when we release version 4.0 in a year or so ;-) FWIW, we're still waiting for the dust to settle before going for a Py3k...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.