Google fusion table update latency - google-fusion-tables

I have created a Google fusion table which I display on a web page. I have written VB.net code to query my fusion table. The code executes correctly, but the query results lag behind edits that have been manually made to the fusion table on the web page. Obviously, I need my VB.net query data to return the data exactly as it is displayed in my fusion table. Does anyone have any ideas what might be causing this delay? It appears that if I wait for 30 seconds to query the fusion table, the results match what is displayed. This delay appears to ONLY occur after the first fusion table edit on the web page, i.e., I can edit one cell in the fusion table and immediately get query results that match the displayed values. This feels like a configuration issue???

I found a solution to my problem. Originally, I was using the following to query my fusion table:
Dim FTqueryRequest As WebRequest = WebRequest.Create(FTqueryURL)
Dim FTqueryResponse As WebResponse = FTqueryRequest.GetResponse()
Dim queryResponsestrmRdr As New StreamReader(FTqueryResponse.GetResponseStream(), True)
When I switched to using Google fusiontablesservice, the query results are identical to what is displayed on the fusion table web page.
Dim mySQLquery = myFusionTablesService.Query.SqlGet("SELECT * FROM " & c_FusionTable_ID).Execute

Related

Totals that fall outside of the query

Newbie to access here.
I'm having an issue that I can't quite get my head around.
I have a very simple db for recording accounting transactions.
It contains, one table for the transactions, one query that returns the transaction amounts between two dates (with a total) and a report that shows the results of the query.
My issue is that I'm trying to add a total for ALL records into the report but I can't figure out how to do it without it just showing the totals from the query.
I've tried referencing the table directly but it returns a name error
I'd like to be able to do this without using VBA or SQL, any help would be most appreciated.
Thanks

Is it posible to get a SQLite Table recordcount prior to opening a query or table?

I am using Delphi 10.1 with FireDac and am using an SQLite Database. I am opening a Query from a timer.Event after the form shows because it takes a bit to load the Query with all records on startup and I want to let the user see something is happening, so showing the form first then loading data make sense to me.
I want to use a progress bar to show the progress as the data is loaded into the Query. I can get the progress using the GetRecords event of the Query and the Query.RecordCount which shows how many records have been fetched so far, but is there a way to get the total records of an SQLite table prior to calling Query.Open or within the GetRecords Event? This way I will be able to show progress as records load.
Thanks for the SQL Tip, SELECT COUNT(*) FROM TABLE Marc.
What actually fixed the slowness of the opening of the Query was not the Query at all, but the populating of the StringGrid. The StringGrid was only there for me and won't be displayed to the user. Disconnecting it from the Query made all the difference in speed.
Thanks, all.

ImportHTML find ALL tables and lists

In Google sheets there is a function called IMPORTHTML which allows you to return tables and lists from HTML pages. However I have no idea how to find out the indexes of the tables or lists I am looking at. Is there a way to figure out ALL of the tables and lists quickly and there respective indexes? I have tried looking at the source on some of the web pages in Chrome and it is unreadable due to how they load the page but somehow the google function knows how to get the 17th table for example. This is a generic question and doesn't apply to any one website but rather ANY website I might want to extract some unknown table number. Right now I am just brute forcing through a bunch of indices which doesn't seem right.
This won't find the exact table you want, but it will give you a list of the tables.
From google developers console enter below to find table numbers
var i = 1; [].forEach.call(document.getElementsByTagName("table"), function(x) { console.log(i++, x); });

YQL not returning data from balance sheet or income statement

I have been trying to use YQL to access the fundamentals of listed companies. But what is showing up in the Yahoo finance page is not being returned from YQL queries. Specifically I need to retrieve data from balance sheet and income statement, a sample query for Apple in YQL is like:
SELECT * FROM yahoo.finance.balancesheet WHERE symbol='AAPL'
This, however, only returns a time frame (quarterly), and nothing else.
Link to YQL console of my sample query is here
Is the data inaccessible to YQL or is there anything wrong with the way I am running the query? How can I get a complete list of data as in http://finance.yahoo.com/q/bs?s=AAPL through YQL?
Your query used to work fine. However, a month or two ago, a number of yahoo.finance YQL "tables" stopped working.
IOW, you are doing it right, but YQL is broken.
If you mouse over the yahoo.finance.balancesheet entry in the left column of the YQL console, buttons labeled desc and src appear. If you click src, it fetches the scraping code for you: http://www.datatables.org/yahoo/finance/yahoo.finance.balancesheet.xml. To make the E4X JavaScript legible, right-click and select View Source or use wget or curl from the command line.
Notice that the code fetches http://finance.yahoo.com/q/bs?s=AAPL&quarterly and then uses an XPath query to find the data:
var query = y.xpath(rawresult, "//table[#class='yfnc_tabledata1']/tr/td/table/tr");
If you fetch the page into your browser and inspect the HTML, you find that there is indeed a table with class yfnc_tabledata1. However, it has no tr direct child. Apparently, Yahoo must have decided to add a tbody element. That probably explains why the query no longer scrapes any data.
The code page lists Ryan Hoium as the author. A little googling leads to the github repository where the code lives, alongside the code for the other Yahoo Finance tables.
Sadly, only the yahoo.finance.sectors table has received recent attention. The change was to add double slashes to its XPath expression. Double-slashes relax the "direct child" requirement, allowing, for example, tr to still be found even if there is an intervening tbody. However, it appears the new version has not been pushed out to the public site.

Check if FusiontableControl insert query successfully uploaded before proceeding

So basically, I am using App Inventor with fusion tables and I have a while loop that uploads every single row of the query and a counter that counts the number of successfully uploaded rows to Google fusion tables.
The loop is like:
while counter <= databaselength
(
call insertquery
counter=counter+1
)
I need to check if every row of the query was successfully uploaded inside the while loop before setting counter=counter+1
Any Suggestions ?
The fusiontable controls in App Inventor work asynchronously, which means, you should use this workflow:(pseudocode)
insert data (one row)
after inserting one row you can check in the fusiontable controls got result event, if the insert was successful and if there are more data to insert
if yes, insert data (next row)
if no: end
In the following example https://puravidaapps.com/filebyfile.php you can learn how to work with asynchronous components. The example however uses the web component. Yes, it's different, but it uses the same logic as mentioned in the pseudo code above. Now use this pseudo code together with the fusiontable controls.

Resources