SArray not saving in database

User 1752 | 6/20/2015, 12:28:15 PM

Hello,

I have a problem that my array result ,not saving in db, showing error..

sf['myawesome'].toodbc(db, 'acool_table')

Error : Sarray object has no attribute ' to_odbc'

How it will be fix ?

Comments

User 1207 | 6/21/2015, 3:51:54 AM

The to_odbc is meant for SFrames, which have column names and other metadata needed to create a database table. Use sf[ ['myawesome'] ].to_odbc(...) to save it as a one-column SFrame / table.


User 1752 | 6/21/2015, 11:56:06 AM

Not working .... see image


User 1207 | 6/21/2015, 9:32:41 PM

What is the type of the column in your SFrame? You can access this through sf.column_types().


User 1752 | 6/22/2015, 6:09:27 AM

The column types is following 1. ID = Int 2. SID = Int 3. Score = Float 4. Rank = Int 5. Interest = list

How I can store these in one table , can you please provide a example & code ?

Thanks for helping in advance...

Thanks


User 15 | 6/22/2015, 5:30:13 PM

Hi,

Our ODBC connector does not support writing list (or dict) types to databases, as most databases don't have a type that corresponds to a list, and neither does the ODBC standard. You can use unpack to split up the list column into many separate columns though, and that should work with many databases. It would look something like this:

<pre> unpackedsf = sf.unpack('Interest') unpackedsf.toodbc(db, 'acool_table') </pre>

Also, which database are you using? to_odbc can be tricky because there's no way to know for sure which database-specific type to pick for each SFrame column type...we use a heuristic to pick the best type, so these errors can happen even without a list or dict type. If the above doesn't work, we'll drill down to what type isn't working.


User 1752 | 6/22/2015, 6:35:32 PM

Hi , Again its not working , please see the image..

Let me know , what you need to fix it ...

Thanks for helping in advance...


User 15 | 6/22/2015, 11:42:18 PM

Can you send me the DBMS name and version (call db.dbmsname and db.dbmsversion and give me the output), and also the server log (the path is printed on startup of GLC)?

Also, the type and a rough approximation for the size of the data within the column (per row and whole column) listed in the error would be great.

Thanks,

Evan


User 1752 | 6/24/2015, 5:52:42 PM

Hi Even , I hope you will be fine ...

The details are following ... 1. DBMS Name : 'Microsoft SQL Server' 2. Version : '11.00.9230' 3. Approximation size of the data : MAX 9KB 4. Server log: /tmp/graphlabserver1435168026.log ( see in log.txt)

-Thanks


User 15 | 6/26/2015, 6:36:16 PM

Okay, this definitely looks like a bug.

A couple more things to verify:

  • Can you send me the list of column names and types for the unpacked_sf here?
  • Can you verify that you are able to write this table to the database without the Interest column, or anything unpack would've created with it? So, just write ID,SID,Score,Rank and make sure that works.

Thanks!

Evan


User 1752 | 6/27/2015, 6:30:24 PM

Hi , Evan ,

Okay ,

The column types & names are following 1. ID = Int 2. SID(similar) = Int 3. Score = Float 4. Rank = Int 5. Interest = list

  • Yes , I able to write the sf & and ID, SID , Score , Rank ! without Interest ... When I create a simple recommendation module... or in simple way ..

Thanks !

Pk


User 1752 | 6/27/2015, 6:34:19 PM

in unpacked_sf I just used the Interest column , 5-10 name in each row.

By using unpacked_sf , its split in 13 column and column name like Interest0, Interest1..........Interest13

Thanks


User 15 | 6/30/2015, 9:35:53 PM

Thank you for that information, that will help me test this. I'll get to this as soon as I can, but unfortunately I don't have a workaround for you immediately. Is this a blocking issue for you?