Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
muz_tim
Contributor
Contributor

LOAD empty QVD

Hi @all

I am trying to load a qvd but only retain the columns and empty out the table
The code below works but it reads all the data first then drop then it. but is proving time consuming because of the size of the QVD 15gb.

LOAD
   *
FROM $(QVD_File) #this is variable that points to the qvd file
WHERE 1=0;

Is there a more efficient way of pulling just the columns similar to df.columns in python

df.columns

 

Labels (1)
1 Solution

Accepted Solutions
marksouzacosta
Partner - Specialist
Partner - Specialist

Not sure if this is most elegant way, but following my suggestion. You just need to replace the variables vTableName and vQVDFilename.

 

SET vTableName = 'CUSTOMER_NEW';
SET vQVDFilename = 'lib://DataFiles/CUSTOMER_NEW.qvd';

[TempLoadStatement]:
LOAD
    CONCAT([FieldName],',') AS [LoadStatement]
FROM
	[$(vQVDFilename)]
	(XmlSimple, table is [QvdTableHeader/Fields/QvdFieldHeader])
;

LET vLoadStatement = FieldValue('LoadStatement',1);

[$(vTableName)]:
LOAD * INLINE [
$(vLoadStatement)
];

STORE [$(vTableName)] INTO [$(vQVDFilename)](qvd);

DROP TABLES
  [TempLoadStatement],
  [$(vTableName)]
;

 

Read more at Data Voyagers - datavoyagers.net

View solution in original post

2 Replies
marksouzacosta
Partner - Specialist
Partner - Specialist

Not sure if this is most elegant way, but following my suggestion. You just need to replace the variables vTableName and vQVDFilename.

 

SET vTableName = 'CUSTOMER_NEW';
SET vQVDFilename = 'lib://DataFiles/CUSTOMER_NEW.qvd';

[TempLoadStatement]:
LOAD
    CONCAT([FieldName],',') AS [LoadStatement]
FROM
	[$(vQVDFilename)]
	(XmlSimple, table is [QvdTableHeader/Fields/QvdFieldHeader])
;

LET vLoadStatement = FieldValue('LoadStatement',1);

[$(vTableName)]:
LOAD * INLINE [
$(vLoadStatement)
];

STORE [$(vTableName)] INTO [$(vQVDFilename)](qvd);

DROP TABLES
  [TempLoadStatement],
  [$(vTableName)]
;

 

Read more at Data Voyagers - datavoyagers.net
muz_tim
Contributor
Contributor
Author

Thanks