![]() #phrases are words separated by spaces (like this comment) Sql_str="INSERT INTO EAT_MY_TWEET (ID,USERNAME,TWEET_JSON) Values("+str(tid)+",q'',:EATIT)" #create sql string with bind for clob var #parse out tweet text, screenname and tweet id #consumer key, consumer secret, access token, access secret. Then all we need to do is write (by which I mean copy paste and modify) a little python code and we are ready to rock: #import librariesįrom tweepy.streaming import StreamListener In order to use the Twitter API you will have to register your app with them here at which point they will give you the keys to make oauth work. "TIMEWHYUPUNISHME" TIMESTAMP (6) DEFAULT systimestamp,ĬONSTRAINT "ENSURE_JSON" CHECK (TWEET_JSON is JSON) ENABLE I created a table in my database to store the JSON document that is the API response CREATE TABLE "TWITTER_USER"."EAT_MY_TWEET" If you have issue with cx_Oracle you most likely just need to make sure the Oracle environment variables are set via bashrc or however you like to set them. Type "help", "copyright", "credits" or "license" for more information. Now that we have all the chunks make sure you can import the stuff you need with python and not get any errors. And last but not least Oracle’s python library for interacting with the database pip install cx_Oracle And then we can fetch Tweepy with equal ease pip install tweepyĥ. Then I can install python-pip with ease yum install python-pipĤ. Latest EPEL repository for this version of linux wget ģ. plliblzma to make it so I can get the latest EPEL repository without having to deal with “expletive” Error: xz compression not available message wget I needed to install 5 things to make this work:ġ. I will assume that you already have a DBAAS instance up and running and are familiar with how to administer it and are also familiar with using tools like MobaXterm to connect to it.Īt the time of this example our Database as a Service is running Oracle Linux 6.7 and 12.0.1.2 of the database with all the bells and whistles. Some might be offended by such interloping but I’m not one of them and as I said above there isn’t any requirement to do this on the database server I’m just taking advantage of a machine that has the cycles to spare. ![]() The great thing about DBAAS is I actually have access to the underlying server so I can take advantage of the operating system, and languages like python, as well as the database.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |