Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Everyone,
How to find out filesize of a table from database?
for example I am loading xyz table from database. I am giving following condition
let vsize = FileSize('"public"."xyz"');
vsize is showing always null value even this table have a data. is there any alternate function ?
Thanks,
Satya
Filesize() is filesystem function used to check size of files on disk not database tables
If you need to check if a table exists or not you need to query the information schema tables of the database
https://docs.oracle.com/cd/E19078-01/mysql/mysql-refman-5.0/information-schema.html#tables-table
Query the information schema table to check if the concerned table exists
for example
Temp:
Select * from information_schema_table where schema =''abc' and tablename='xyz';
then use this information to proceed with IF block
if NoOfRows('Temp')>0 THEN <<--if noofrows('Temp') > 0 means the concerned table exists in database
something
Else
Something else
End IF
FileSize is for checking the size of files. A database table is not a file...
Most database providers let you find out the size of a specific table (as it exists within the DB), e.g.
https://chartio.com/resources/tutorials/how-to-get-the-size-of-a-table-in-mysql/
https://ppolyzos.com/2016/11/22/get-size-of-tables-in-sql-server/
But this is not native to Qlik.
Hi,
Thank you so much for response. Here we want to see a particular table exists in the database or not?
Our requirement is, My application should continue execution even the table is not available in the database. It have run from next load statement.
So we were using following
let vsize = FileSize('"public"."xyz"');
if isnull(vsize) =-1
LET vExistFile = 0;
else
LET vExistFile = 1;
endif;
if '$(ExistFile)' then
Load statement
endif
Load Statement
you can check below requirement
Solved: Re: How to ignore cannot open file error qliksense - Qlik Community - 1923296
could you please help how to resolve this?
Thanks,
Satya
Filesize() is filesystem function used to check size of files on disk not database tables
If you need to check if a table exists or not you need to query the information schema tables of the database
https://docs.oracle.com/cd/E19078-01/mysql/mysql-refman-5.0/information-schema.html#tables-table
Query the information schema table to check if the concerned table exists
for example
Temp:
Select * from information_schema_table where schema =''abc' and tablename='xyz';
then use this information to proceed with IF block
if NoOfRows('Temp')>0 THEN <<--if noofrows('Temp') > 0 means the concerned table exists in database
something
Else
Something else
End IF
Hi @vinieme12
Thank you so much. This is the result I am expecting