API/Python/Open-Source Solutions

Expand all | Collapse all

Source in API not always returning consistent DB name values

  • 1.  Source in API not always returning consistent DB name values

    Posted 07-21-2015 08:35:00 AM
    Hi all Has anyone else seen this issue? I store details about all the VDBs in a SQL database, using the API to get the information. I;ve found that the API is sometimes returning the correct name for the SQL database (not VDB name) and sometimes isn't. Let me provide an example /resources/json/delphix/source/MSSQL_VIRTUAL_SOURCE-1389 This returns {"type":"OKResult","status":"OK","result":{"type":"MSSqlVirtualSource","reference":"MSSQL_VIRTUAL_SOURCE-1389","namespace":null,"name":"Charting","description":null,"virtual":true,"staging":false,"container":"MSSQL_DB_CONTAINER-3059","config":"MSSQL_SINGLE_CONFIG-1979","enabled":true,"status":"DEFAULT","runtime": The DB is called Charting and the VDB name is called RISK-Daily-Charting. I collect all this via the API and my SQL database reflects this GroupName - TEAM - RISK ServerName - TGT_PROD: PKH-SRV-REP02 SQLInstanceName - MSSQLSERVER SQLVersion - 10.53.6000.34 ServerEnabled - 1 DBNameSQL - Charting DBNameDelphix - RISK-Daily-Charting However, other sources return with the DB name the same as VDBName when it isn't eg /resources/json/delphix/source/MSSQL_VIRTUAL_SOURCE-777 This returns {"type":"OKResult","status":"OK","result":{"type":"MSSqlVirtualSource","reference":"MSSQL_VIRTUAL_SOURCE-777","namespace":null,"name":"DBA-Daily-DBCC_Charting","description":null,"virtual":true,"staging":false,"container":"MSSQL_DB_CONTAINER-1761","config":"MSSQL_SINGLE_CONFIG-1261","enabled":true,"status":"DEFAULT","runtime": But the DB within SQL is actually called Virtual_DBCC_Charting and the VDB name is called DBA-Daily-DBCC_Charting. I collect all this via the API and my SQL database incorrectly states this GroupName - TEAM - DBATEAM - RISK ServerName - TGT_PROD: PKH-SRV-DBAMGMTTGT_PROD: PKH-SRV-REP02 SQLInstanceName - MSSQLSERVER SQLVersion - 11.2.5058.010.53.6000.34 ServerEnabled - 1 DBNameSQL - DBA-Daily-DBCC_Charting DBNameDelphix - DBA-Daily-DBCC_Charting Does anyone know why some sources in the API are showing the SQL database name, whereas others are using the VDBName? Is there a way to constantly get the actual SQL database name?
    #Tip


  • 2.  RE: Source in API not always returning consistent DB name values

    Posted 07-21-2015 12:48:00 PM
    Hello,

    I think the "name" field that is returned is the name of the object in Delphix which can be different than the name of the database. In the GUI, if you flip the VDB's card over, what does it show for "Database Name"?

    If they are different, one suggestion would be to make sure they are the same. If you disable the VDB under the GUI, a pencil icon will appear next to the "Database Name" and you can change it. Or you can rename the object without disabling the VDB. However, if you are after the true "databaseName", it might be safer to use the "sourceconfig" API:

    /resources/json/delphix/sourceconfig/MSSQL_SINGLE_CONFIG-9

    {"type":"OKResult","status":"OK","result":{"type":"MSSqlSIConfig","reference":"MSSQL_SINGLE_CONFIG-9","namespace":null,"name":"VDBNeal","linkingEnabled":true,"discovered":false,"environmentUser":"HOST_USER-2","repository":"MSSQL_INSTANCE-1","databaseName":"VDBNeal","user":null,"credentials":null,"instance":{"type":"MSSqlInstanceConfig","host":"WINDOWS_HOST-2"}},"job":null,"action":null}

    Thanks,

      Neal



  • 3.  RE: Source in API not always returning consistent DB name values

    Posted 07-21-2015 02:01:00 PM
    Thanks Neal

    I will check this out...just seems weird that some are returning with the actual SQL DB name and some are coming up with the VDB name....there doesn't seem to be any consistency.

    I will change it over to use the config details in the API...just checked that out and seems to be correct...thanks a lot




  • 4.  RE: Source in API not always returning consistent DB name values

    Posted 07-21-2015 03:57:00 PM
    Mark, I assume this varies by data type (that is, MSSQL always gives you what you expect, but Oracle doesn't)?


  • 5.  RE: Source in API not always returning consistent DB name values

    Posted 07-22-2015 07:25:00 AM
    Hi David

    No these are all MSSQL data types...this is how it looks in the UI
     

     

    API Returns

    {"type":"OKResult","status":"OK","result":{"type":"MSSqlVirtualSource","reference":"MSSQL_VIRTUAL_SOURCE-1389","namespace":null,"name":"Charting","description":null,"virtual":true,"staging":false,"container":"MSSQL_DB_CONTAINER-3059","config":"MSSQL_SINGLE_CONFIG-1979","enabled":true,"status":"DEFAULT","runtime":

    {"type":"OKResult","status":"OK","result":{"type":"MSSqlVirtualSource","reference":"MSSQL_VIRTUAL_SOURCE-777","namespace":null,"name":"DBA-Daily-DBCC_Charting","description":null,"virtual":true,"staging":false,"container":"MSSQL_DB_CONTAINER-1761","config":"MSSQL_SINGLE_CONFIG-1261","enabled":true,"status":"DEFAULT","runtime":

    So I would expect the API to either return 
    Charting
    Virtual_DBCC_Charting

    or
    RISK-Daily-Charting
    DBA-DAily-DBCC_Charting

    not a mixture of the both