473,698 Members | 2,047 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1406
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:sli ce_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:sli ce_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.column 1 ?

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:sli ce_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:sli ce_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__(sel f, att):
if att in self.headers:
return self[att]
else:
return self.__getattri bute__(att)

James

Feb 15 '07 #3

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

Similar topics

3
3594
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. The project's meta information is put into a project table, mysql_insert_id() gets the $proj_ID, and a table named that $proj_ID is created to hold all of that project's tasks. Here is my code to create the table for a project's tasks: // 2)...
4
4435
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 creates a table called "@NewTableName". Any ideas? CREATE PROCEDURE dbo.sp_FFProduction_CreateTable (
4
2541
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 me to some source code? I'm a newbie. TIA John
1
1185
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 adapter I have to give it the connection type. Ie SQLClient, ODBC etc. This mean that if I want to change from say SQL to ODBC I will have to recreate the table adapters as I can't just change the connection type as it brings up loads of errors.
3
2005
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? thanks in advance, chance.
0
8674
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, 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...
0
9026
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...
1
8893
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
8861
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
4366
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
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3045
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
2328
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2001
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.