+ Start a Discussion
John FlintJohn Flint 

Converting an Enterprise WSDL to SQL Create statement

I am trying to find a quick way to create tables in a SQL database that mirrors the confgiuration of objects in Salesforce.  It is easy enough to generate an enterprise WSDL that shows that the current object structure.  Does anyone know of a tool that will convert it to a SQL create statement?  Any other suggestions on how to quickly generate tables for a SQL based database so you can load a mirror of your data?


So I tend to ignore anything Enterprise WSDL and always go with Partner.  I can't expect this to be too hard, but I've never tried to do this myself.  Getting a list of the objects is a query that is there but I don't remember what it is.  Some kind of GlobalDescribe or maybe it's in the MetaData.


Everything else is somewhat simple.  I wish I had my old cost that would render HTML based on the results of a query, but that's tucked away somewhere in the old SVN code and I don't feel like digging it out.  Anyways, everything relies on the DescribeSObject call.



                    foreach ($mySforceConnection->describeSObject($object_type)->fields as $object)
                            if ($object->type == 'phone' && $object->label != 'Fax' && $object->name != 'Fax')
                                    $phoneArray[] = $object->name;
The above lines are what I personally use for detecting phone fields in an object.  But for you, I'd suggest just printing out all the results and see what data is there.  Picklists are slightly complicated, but all the data is there on the Describe call.  Number and text fields all have length fields.