Currently, I want to store the information obtained from the API in a SQL database.
I want to transfer the information obtained from the Twitter API to the SQL database, so
When I entered the following code with reference to, an error occurred.
>>>from twitter import * >>>auth = OAuth ( ... consumer_key ='QyVL7V9u4m61xeUxRSignDdVR', ... consumer_secret ='fgPDeUP0WKhXSRgkYiH7CrU3qiUEmtUV5DTRboMuq3WSEysATO', ... token = '000', ... token_secret = '000' ...) >>>params = dict () >>>params ["locations"] = "139.48, 35.30, 139.57, 35.34" >>>twitter_stream = TwitterStream (auth = auth, domain ='stream.twitter.com') >>>import psycopg2 >>>conn = psycopg2.connect (host ='localhost', dbname ='twitterdb', user ='postgres', password = '000', port = '5432') >>>cur = conn.cursor () >>>command ='''INSERT INTO TwitterUser (id, text, geo.coordinates) VALUES (% s,% s) ON CONFLICT ... (User_Id) DO NOTHING;''' >>>cur.execute (command, (id, text, geo.coordinates)) Traceback (most recent call last): File "<stdin>", line 1, in<module> NameError: name'text' is not defined
Therefore, I considered the following two possibilities by investigating.
● The exported Twitter data name is incorrect
On the Twitter developer site
When I referred to, the data name matched the one described in the response field.
● The table information of pgadmin4 does not match.
The datatype described on the site was not on the datatype selection screen of pgadmin4.
Therefore, I think this may be the cause.
Is it because the datatype set in table does not match?
Also, when setting datatype in pgadmin4, is there a type corresponding to string, object, and array?
The image of pgadmin4 is also attached.
Answer # 1
Since the number of values of values was small in insert, it was supported.
- ruby on rails - no information sent to database
- when sending information from html to a database through php, don't you reveal your password?
- python - i want to save a database on heroku by creating a discord bot, but i don't understand how to handle heroku redis
- python - i want to skip the header information when outputting the request result in csv
- i want to extract specific information from a python string
- i want to get twitter retweet information with python
- i want to get retweet information with python without any limit on the number of retweets and the period
- python - [scipy-interpolate] i want to interpolate the time information and coordinate data into data every second
- information entered in html in vuejs cannot be sent to python with cgi
- python - how to enter confidential information of desktop applications that are supposed to be distributed
- java - i want to display the information selected from the database with jsp
- python - i want to find the height information of each pixel in the image
- php: i want to display the database information after inserting the data entered from the form
- python - does pixel information change when cv2imwrite processing is performed?
- how to quote database information in a text box when filling out an access vba form
- unable to get database values in python django
- join python and database? i want to know what i can do with
- i want to get the information of the file opened by the program made with python from "open with"
- python - how to read the sqlite database again?
- python : Fetchall Pymysql output conversion in Int ..?
- Automation in Python through Pyhive
- python : Exmo API. I can not legitiate
- python : It's impossible to make the right API request
- python : problem with issuing role
- python : How to output the result of the query from the database, in the Django pattern
- python : Implementation of the API Django.
- python : QSQLTableModel Vertical title
- python : Creating an aggregator site
- python : QStyLeDiteMDelegate problem with the preservation of entered data