CSV Export inconsistancies

27 views
Skip to first unread message

Rommel Villa

unread,
Jan 19, 2017, 4:58:42 PM1/19/17
to RavenDB - 2nd generation document database
Hi,

Currently we are using ravendb 3.0.3660 .

I am currently trying to export data into a csv format to be injested by another system on scheduled basis using the following URL.

<myurl>/databases/MyDB/streams/query/Raven/DocumentsByEntityName?query=Tag:<targetcollection>&format=excel&download=true

Now interesting enough, the csv export seems to be inconstant where

  • Sometimes as expected, all fields in subdocuments are exported as individual columns.
  • Sometimes those subdocuments are just transformed as a json string.

For example we had two documents, one user, another event, both have a field called address. In the exported csv one was a Address with a json string, the other had all address fields as separate column. See the example below.

Document Type

Field

Value

User

Address

{"Street":"123 main street","PostalCode":"90120","City":"Medicine Hat","Region":"Alberta","Country":"Canada"}

Event

Address.Street

123 main street

 

Address.PostalCode

90120

 

Address.City

Medicine Hat

 

Address.Region

Alberta

 

Address.Country

Canada



Any ideas why this might be happening? 


Thanks in advance

Oren Eini (Ayende Rahien)

unread,
Jan 19, 2017, 6:57:10 PM1/19/17
to ravendb
Are all your documents in the same format?

Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 


--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Rommel Villa

unread,
Jan 20, 2017, 10:01:24 AM1/20/17
to RavenDB - 2nd generation document database
Hi Oren,

Thanks for the response.

Just to be clear on what you are asking, no between collections, but they have the same structure within the collection to be clear. Between the collections have common fields/subdocuments (use common classes in our POCO application) that have similar structure. Same example with Address


User: {  
   "FirstName":"FirstName",
   "LastName":"LastName",

   "Address": 
      "Street":"123 main street",
      "PostalCode":"90120",
      "City":"Medicine Hat",
      "Region":"Alberta",
      "Country":"Canada"
   },
   "Title":"Someone"
}

Events: {  
   "Name":"EventName",
   "Address":"LastName",

   "Address": 
      "Street":"123 main street",
      "PostalCode":"90120",
      "City":"Medicine Hat",
      "Region":"Alberta",
      "Country":"Canada"
   },
   "Title":"Someone",
   "Dates": 
       
         "StartDate":"2016-06-11T01:00:00.0000000",
         "EndDate":"2016-06-11T01:00:00.0000000"
      },
       
         "StartDate":"2016-07-09T01:00:00.0000000",
         "EndDate":"2016-07-09T01:00:00.0000000"
      }
   ]
}


Also in many cases to some of more complex subdocuments, which is common to some of our collections, raven appears to export them to csv correctly.

"Events":"Location": {
        "type": "Feature",
        "geometry": {
            "type": "Point",
            "coordinates": [
                -113.850783,
                50.572892
            ]
        },
        "properties": {
            "GeoLocationSource": "User",
            "Description": null,
            "ConfidenceLevel": "high"
        }
   
To these columns

 

Document Type

Field

Value

Event

Location.type

Feature

Location.geometry

{

            "type": "Point",

            "coordinates": [

                -113.850783,

                50.572892

            ]

        }

 

Location.geometry.coordinates

[

                -113.850783,

                50.572892

            ]

 

Location.properties

{

            "GeoLocationSource": "User",

            "Description": null,

            "ConfidenceLevel": "high"

        }

 

Location.properties.GeoLocationSource

User

 

Location.properties.Description

 

Location.properties.ConfidenceLevel

High

 


To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.

Oren Eini (Ayende Rahien)

unread,
Jan 21, 2017, 8:07:43 AM1/21/17
to ravendb
We have some heuristics around the CSV generation, but that is all customizable to the user by defining a transfomer.
At any rate, the logic is here:

If this is a simple value, it is send directly as a column, otherwise the column is set to the json of the complex value
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages