Google2Pandas | Query Google Analytics and get the results | Analytics library
kandi X-RAY | Google2Pandas Summary
kandi X-RAY | Google2Pandas Summary
Query Google Analytics and get the results as a pandas.DataFrame
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Execute a query
- Parse query
- Add filter argument to query
- Add sort argument to query
- Add data to query
- Executes a query
- Convert the response to a pandas dataframe
- Authenticate credentials
- Create flow from secrets
Google2Pandas Key Features
Google2Pandas Examples and Code Snippets
Community Discussions
Trending Discussions on Google2Pandas
QUESTION
i have a quick question this is my python code to retrieve data from google analtycs api. it works just fine. i would like now to push the result into maria database running on my local machine. i built alrady the scheme and the table in mysql. i was able to establish the connection with maria db. Can you show me how to push the data stored in to the variable "df" into the database?
import google2pandas from google2pandas import * conn = GoogleAnalyticsQuery(secrets='C:/Users/blabla/OneDrive/MyFiles/Documents/analysis/ga-creds/ga-credsclient_secrets.json', token_file_name='C:/Users/l.longo/OneDrive/MyFiles/Documents/analysis//ga-creds/analytics.dat') query = {\ 'ids' : 'ga:23185143', 'metrics' : 'pageviews', 'dimensions' : ['date', 'pagePath'], 'start_date' : '8daysAgo' }
df, metadata = conn.execute_query(**query) print(df) import mysql.connector as mariadb mariadb_connection = mariadb.connect(user='root', password='xxxxx', database='xxxxxx') cursor = mariadb_connection.cursor()
here you have the results i get from analytics api
...ANSWER
Answered 2018-Jun-04 at 18:52You can use INSERT
statement over your mysql connection.
Check this question
Inserting Data using MySql Connector in Python
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Google2Pandas
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page