473,767 Members | 1,695 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1655
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.pytho n:

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.netc om.com | Wulfraed Dennis Lee Bieber KD6MOG <
wu******@dm.net | Bestiaria Support Staff <
=============== =============== =============== =============== == <
Home Page: <http://www.dm.net/~wulfraed/> <
Overflow Page: <http://wlfraed.home.ne tcom.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
1817
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 XSLT will be stored on the client cache.So only the xml is transferred to client & the xslt transforms it into xhtml & displays it. Will this improve performance or have i gone nuts??
23
2827
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. Is mySQL a nice start with python ? Sincerely Yours, Pujo
6
3585
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 interface. Applications that I know of (that they exist) are: MS Excel Quattro
2
1100
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 that would be good also. Thanks
0
2167
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
3100
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 View project althought rewritten in 1994, and has been used in a lot of bioinformatics projects http://www.eyedb.org/ Python does not have any programming interface to ODBMS and I believe that it would be very interesting that the Python...
8
2905
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 ? Note: The database's size is 200 GB
1
3158
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 python as 'date' object and not as string.
0
832
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
979
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 port of the mx C extensions. -- Marc-Andre Lemburg
0
9405
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
10169
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...
0
10013
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8838
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...
0
5280
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5424
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3930
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3533
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2807
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.