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

anyway to create a table-like object?

Dear all,

is there a way to create a 2-dimension-table-like object such that I
can reference a whole column directly using something like :
mytable.column1 ?

by the way, can python be used for database programming to pull large
volume data (hundred M or even several Gs) out of large database and
do data manipulation and reporting ? if yes, how is the speed and
efficiency ?

thanks.

wensui
Feb 14 '07 #1
2 1394
Wensui Liu wrote:
Dear all,

is there a way to create a 2-dimension-table-like object such that I
can reference a whole column directly using something like :
mytable.column1 ?

by the way, can python be used for database programming to pull large
volume data (hundred M or even several Gs) out of large database and
do data manipulation and reporting ? if yes, how is the speed and
efficiency ?

thanks.

wensui
I have a table class that works like this:

atable['some_col'] ==list of values
atable[some_row_index] ==list of values
atable[slice_start:slice_end] ==new table
atable[('some_col', 'other_col', 'another_col')] ==3 col. table
atable['some_col', some_row_index] ==one value
atable['some_col', slice_start:slice_end] ==list of values
atable[('some_col', 'other_col'), some_row_index] ==list of 2 vals
atable[('some_col', 'other_col'), slice_start:end]) ==2 col. table

As you can see, it has a lot of flexibility, but may not be the ultimate
in terms of speed (and purists may not like the way __getitem__ returns
data based on context). It is for people who care about convenience over
speed and do not adhere to some puritanical ideal about how __getitem__
should work. There is little typechecking (in accord with my own brand
of puritanical philosophy), so be careful if you have ints as column
headers. The datastructure is implemented as a list of lists (by row)
and the "keys" (column headings) are a list. So size limitations are
limited by memory. Theoretically, the __getitem__ (where all the work
and decisions are done) could be factored out and wrapped around dbi for
hard-core database usage. This might entail some serious creativity.

It also has some other features, such as returning matches, etc. It is
not intended, at all, to rival an actual database such as mysql--the
model is more based on how Joe Users use excel files.

If you are interested, I can send you the module. Beyond actual use in
my own and my wife's work, there has been little testing.

James
Feb 15 '07 #2
James Stroud wrote:
Wensui Liu wrote:
>Dear all,

is there a way to create a 2-dimension-table-like object such that I
can reference a whole column directly using something like :
mytable.column1 ?

by the way, can python be used for database programming to pull large
volume data (hundred M or even several Gs) out of large database and
do data manipulation and reporting ? if yes, how is the speed and
efficiency ?

thanks.

wensui


I have a table class that works like this:

atable['some_col'] ==list of values
atable[some_row_index] ==list of values
atable[slice_start:slice_end] ==new table
atable[('some_col', 'other_col', 'another_col')] ==3 col. table
atable['some_col', some_row_index] ==one value
atable['some_col', slice_start:slice_end] ==list of values
atable[('some_col', 'other_col'), some_row_index] ==list of 2 vals
atable[('some_col', 'other_col'), slice_start:end]) ==2 col. table

As you can see, it has a lot of flexibility, but may not be the ultimate
in terms of speed (and purists may not like the way __getitem__ returns
data based on context). It is for people who care about convenience over
speed and do not adhere to some puritanical ideal about how __getitem__
should work. There is little typechecking (in accord with my own brand
of puritanical philosophy), so be careful if you have ints as column
headers. The datastructure is implemented as a list of lists (by row)
and the "keys" (column headings) are a list. So size limitations are
limited by memory. Theoretically, the __getitem__ (where all the work
and decisions are done) could be factored out and wrapped around dbi for
hard-core database usage. This might entail some serious creativity.

It also has some other features, such as returning matches, etc. It is
not intended, at all, to rival an actual database such as mysql--the
model is more based on how Joe Users use excel files.

If you are interested, I can send you the module. Beyond actual use in
my own and my wife's work, there has been little testing.

James
Also, if you want columns as attributes (which may be pretty cool):

def __getattr__(self, att):
if att in self.headers:
return self[att]
else:
return self.__getattribute__(att)

James

Feb 15 '07 #3

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

Similar topics

3
by: Andrew | last post by:
I have a problem creating mySQL tables with PHP. I am making an app where a user can create a project. Pressing "submit" on proj_form.php goes to proj_add.php where a couple of things happen. ...
4
by: Michael Jackson | last post by:
I have a stored procedure to create a table. In my program I want the user to name the table to be created, therefore I pass a parameter to the SP for the table name. I cannot get it to work. It...
4
by: John T. Howard | last post by:
Can you issue commands from VB.Net to create and delete databases? I would like to create, delete, and copy MSAccess tables and/or databases from code. Can this be done? Can you show, or point...
1
by: Mike Davies | last post by:
Hi All, I have just discovered the dataset designer in Visual Studio 2005 and really love it. It makes it a piece of cake to produce a DAL to the DB. But I was wondering, when I create a table...
3
by: chance | last post by:
I have this code: DataRow row = docAttachTable.NewRow(); docAttachTable.Rows.Add(row); What I want to know is the primary key number (it's auto-generated). Is there anyway to do that? ...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
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...
0
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...
0
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...

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.