DFP Log Tables and Schema in Redshift

In [18]:
for tbl in list_tables('rsprod', 'wfx_dfp_data').iloc[:,0]:
    if 'wmt' not in tbl:
        print(tbl)
activities_log
clicks_log
video_conversions_log
active_views_log
impressions_log
creatives
lineitem_creative_assoc
targeting_values
lineitem_custom_targeting
targeting_keys
adunit
lineitem_inventory_targeting
lineitem_geo_targeting
orders
lineitems
advertiser

In [1]:
for tbl in [str(e) for e in list_tables('rsprod', 'wfx_dfp_data').iloc[:,0]]:
    if "wmt" not in tbl and "r_impressions" not in tbl and "custom" not in tbl:
        print(tbl)+":\n",
        print("=====================================")
        print(queryrsprod('select * from wfx_dfp_data.{table} limit 3'.format(table=tbl))),'\n\n'
activities_log:
=====================================
                 time                  userid       ip advertiser_id   order_id lineitem_id  creative_id  \
0 2014-10-25 06:32:36  1zhBPEWzMg7zU-am5Jn7Lw  0.0.0.0      46849577  199933217   113151377  45173270417   
1 2014-10-25 08:02:41  wUBfP6HixQLRpFt60jZ0OQ  0.0.0.0      46849577  199933217   113151377  45173270417   
2 2014-10-25 08:03:36  x4fh-Tq8L0dGz6oO6rSYyA  0.0.0.0      46849577  199933217   113151377  45173270417   

  creative_version creative_size adunit_id  \
0                1       300x251  25641017   
1                1       300x251  25640057   
2                1       300x251  25641497   

                                                                                      custom_targeting       domain  \
0  pos=wx_300var;preempt=y;age=nl;amznslots=a453x142p13;baro=stdy;cc=us;cnd=cld;cobr=nl;ct=mount sh...  verizon.net   
1  pos=wx_300var;preempt=y;age=nl;amznslots=nl;cat=home_and_garden;cc=nl;ch=safety_and_preparedness...  comcast.net   
2  pos=wx_300var;preempt=y;age=nl;amznslots=nl;baro=stdy;cc=us;ch=pets;cnd=cld;cobr=nl;ct=hammond;d...  comcast.net   

  country_id        country region_id      region metro_id            metro  city_id          city postal_code_id  \
0       2840  United States     21164  New Jersey   200504  Philadelphia PA  1022178    Hightstown        9003932   
1       2840  United States     21147    Illinois   200602       Chicago IL  1016446  Elmwood Park        9021766   
2       2840  United States     21148     Indiana   200602       Chicago IL  1017131       Hammond        9016191   

  postal_code browser_id                             browser   os_id                       os bandwidth bandwidth_id  \
0       08520     500072                       Google Chrome  501010  Microsoft Windows Vista     cable       502002   
1       60707     500072                       Google Chrome  501013                  Android      wifi       502012   
2       46324     500123  Microsoft Internet Explorer 11.Any  501026      Microsoft Windows 8     cable       502002   

    time_usec gfp_activity_id                         gfp_activity_name  quantity  revenue                 ord  \
0  1414233156          102257  108013_NOVEN/BRISDELLE_CONVERSION_082014         1        0  2611342179588.9736   
1  1414238561          102257  108013_NOVEN/BRISDELLE_CONVERSION_082014         1        0   5801700362935.662   
2  1414238616          102257  108013_NOVEN/BRISDELLE_CONVERSION_082014         1        0   3213756950293.561   

  gfp_activity_ad_event_type gfp_activity_ad_event_time    requested_adunit_sizes    product bandwidth_group_id  \
0                  PostClick        2014-10-25 06:32:31  300x600|300x1050|300x251  Ad Server                  4   
1                  PostClick        2014-10-25 08:02:39  300x600|300x1050|300x251  Ad Server                  6   
2                  PostClick        2014-10-25 08:03:35  300x600|300x1050|300x251  Ad Server                  4   

  iscompanion dfpfiledate  
0       False  2014-10-25  
1       False  2014-10-25  
2       False  2014-10-25   


clicks_log:
=====================================
                 time                  userid       ip advertiser_id   order_id lineitem_id  creative_id  \
0 2014-09-22 23:19:48  q7eieX-mB7BVpUWR6c0wRw  0.0.0.0      31450217  203237897   101868617  47269596497   
1 2014-09-23 01:50:28  Iwwn-cX8F8nuKbJaIdtPLQ  0.0.0.0      48729377  206582657   107553857  47530048937   
2 2014-09-23 02:39:01  IYgNqxevzUc2hjXGlLkUjQ  0.0.0.0      31842857  194269457    95286377  46228991537   

  creative_version creative_size adunit_id  \
0                1        320x50  53026097   
1                1       300x250  53026217   
2                1        320x50  25628057   

                                                                                      custom_targeting       domain  \
0  age=nl;aid=wd81618s1u22n94op9g9sp59s30qssp8n8nn;bn=n;cc=us;cnd=clr;ct=milwaukee;dma=617;faud=f21...  verizon.net   
1  age=nl;aid=5136a7880n7b164834hb2s3rps9pop2q887s;bn=n;cc=us;cnd=pcld;ct=colbert;dma=881;faud=f207...  comcast.net   
2  aid=v48f6sd4cai6ppou0783;cc=us;cnd=clr;ct=flowood;dma=718;faud=4;faud=f212;faud=f202;faud=f209;f...                

  country_id        country region_id         region metro_id                    metro  city_id         city  \
0       2840  United States     21152  Massachusetts   200506  Boston MA-Manchester NH  1018174      Danvers   
1       2840  United States     21180     Washington   200881               Spokane WA  1027760      Spokane   
2       2840  United States     21158    Mississippi   200710    Hattiesburg-Laurel MS  1020746  Hattiesburg   

  postal_code_id postal_code browser_id                       browser   os_id         os bandwidth bandwidth_id  \
0        9001926       01923     500104  Safari (iPhone/iPod) Any.Any  501012  Apple iOS      wifi       502012   
1        9033780       99201     500104  Safari (iPhone/iPod) Any.Any  501012  Apple iOS      wifi       502012   
2              0                 500072                 Google Chrome  501013    Android   carrier       502013   

    time_usec requested_adunit_sizes    product bandwidth_group_id iscompanion dfpfiledate  
0  1411442388          320x50|320x80  Ad Server                  6       False  2014-09-23  
1  1411451428        300x250|320x300  Ad Server                  6       False  2014-09-23  
2  1411454341                 320x50  Ad Server                  7       False  2014-09-23   


video_conversions_log:
=====================================
                 time                  userid       ip advertiser_id   order_id lineitem_id  creative_id  \
0 2014-11-26 03:00:04  6XxXE7mu4-CiCf7Zf0WmGQ  0.0.0.0      47777057  203387657   101962457  46558974377   
1 2014-11-26 03:00:04  6XxXE7mu4-CiCf7Zf0WmGQ  0.0.0.0      47777057  203387657   101962457  46558974377   
2 2014-11-26 03:00:06  6XxXE7mu4-CiCf7Zf0WmGQ  0.0.0.0      47777057  203387657   101962457  46558974377   

  creative_version creative_size adunit_id  \
0                1      640x480v  44869817   
1                1      640x480v  44869817   
2                1      640x480v  44869817   

                                                                                      custom_targeting  domain  \
0  amznslots=undefined;baro=nl;cat=science_mother_nature_revealed;cc=us;ch=mother_nature_revealed;c...  rr.com   
1  amznslots=undefined;baro=nl;cat=science_mother_nature_revealed;cc=us;ch=mother_nature_revealed;c...  rr.com   
2  amznslots=undefined;baro=nl;cat=science_mother_nature_revealed;cc=us;ch=mother_nature_revealed;c...  rr.com   

  country_id        country region_id          region metro_id                             metro  city_id    city  \
0       2840  United States     21160  North Carolina   200560  Raleigh-Durham (Fayetteville) NC  1021117  Garner   
1       2840  United States     21160  North Carolina   200560  Raleigh-Durham (Fayetteville) NC  1021117  Garner   
2       2840  United States     21160  North Carolina   200560  Raleigh-Durham (Fayetteville) NC  1021117  Garner   

  postal_code_id postal_code browser_id        browser   os_id       os bandwidth bandwidth_id   time_usec  \
0        9009683       27529     500072  Google Chrome  501013  Android      wifi       502012  1416988804   
1        9009683       27529     500072  Google Chrome  501013  Android      wifi       502012  1416988804   
2        9009683       27529     500072  Google Chrome  501013  Android      wifi       502012  1416988806   

           action_name action_type  action_count  action_duration gfp_content_id requested_adunit_sizes    product  \
0                Start    Standard             1                1              0                640x480  Ad Server   
1        Creative view    Standard             1                1              0                640x480  Ad Server   
2  viewable_impression    Standard             1                1              0                640x480  Ad Server   

  bandwidth_group_id iscompanion dfpfiledate  
0                  6       False  2014-11-26  
1                  6       False  2014-11-26  
2                  6       False  2014-11-26   


active_views_log:
=====================================
                 time                  userid advertiser_id   order_id lineitem_id  creative_id creative_version  \
0 2014-10-27 03:00:00  kdhEei2gltpCzvJNO8Sx-w      24975377  205221857   103157897  47362685897                1   
1 2014-10-27 03:00:00  mUXw2L-FOM-WwHg7TfnvAQ      24975377  205221857   103157897  47362685897                1   
2 2014-10-27 03:00:00  xnjUtPojnXaPudolklxJ6g      16672337  211982657   113467577  48616513937                1   

  creative_size adunit_id  \
0       300x600  25651097   
1       300x600  25640417   
2       300x251  25641377   

                                                                                      custom_targeting       domain  \
0  pos=wx_300var;preempt=y;age=nl;amznslots=nl;baro=stdy;cat=travel;cc=us;cnd=clr;cobr=nl;ct=salem;...  comcast.net   
1  pos=wx_300var;preempt=y;age=nl;amznslots=nl;baro=stdy;cc=us;ch=istate;cnd=cld;cobr=nl;ct=rockfor...  comcast.net   
2  pos=wx_300var;preempt=y;age=nl;amznslots=nl;baro=stdy;cc=us;ch=pets;cnd=clr;cobr=nl;ct=san luis ...                

  country_id        country region_id      region metro_id                                         metro  city_id  \
0       2840  United States     21170      Oregon   200820                                   Portland OR  1024555   
1       2840  United States     21147    Illinois   200610                                   Rockford IL  1016813   
2       2840  United States     21137  California   200855  Santa Barbara-Santa Maria-San Luis Obispo CA  1014232   

              city postal_code_id postal_code browser_id                browser   os_id         os       os_version  \
0            Salem        9032964       97302     500103  Safari (iPad) Any.Any  501012  Apple iOS  EqualTo_iOS_8_0   
1         Rockford        9021890       61107     500121           Safari 5.Any  501008  Macintosh                    
2  San Luis Obispo        9031723       93405     500071     Safari Other.Other  501008  Macintosh                    

  bandwidth   time_usec  \
0      wifi  1414393200   
1       dsl  1414393200   
2        t3  1414393200   

                                                                                       audience_seg_id    product  \
0  7080130|7080610|7080730|7081690|7084810|7085410|8605690|11360170|18131050|20190010|21378850|2213...  Ad Server   
1                                                                                                       Ad Server   
2                                                                                                       Ad Server   

     requested_adunit_sizes bandwidth_group_id    mobile_device mobile_capability mobile_carrier gfp_content_id  \
0  300x600|300x1050|300x251                  6  iPad_from_Apple                             Wifi              0   
1  300x600|300x1050|300x251                  3                                                                0   
2  300x600|300x1050|300x251                  5                                                                0   

  video_position video_fallback_pos pod_position iscompanion publisher_provided_id  \
0              0                  0            0       False                         
1              0                  0            0       False                         
2              0                  0            0       False                         

                   targeted_custom_criteria measurable_imps viewable_imps dfpfiledate  
0           pos=wx_300var;wfxtg=211;plat=wx              N             NA  2014-10-27  
1           pos=wx_300var;wfxtg=211;plat=wx              Y             Y   2014-10-27  
2  pos=wx_300var;tf=today;plat=wx;wfxtg=362              Y             Y   2014-10-27   


impressions_log:
=====================================
                 time                  userid       ip advertiser_id   order_id lineitem_id  creative_id  \
0 2014-10-27 02:50:16  qHgdKq5U744832Qhhif3xA  0.0.0.0      16672337  214223417   115559897  49430236097   
1 2014-10-27 02:50:17  iV2yp9Z40bva39uCDbbSFw  0.0.0.0      16722617  213165257   114782657  49232316737   
2 2014-10-27 02:50:20  atYVBcKaEREvLenBep7Nfg  0.0.0.0      20155817  205949777   116368217  49489962257   

  creative_version creative_size adunit_id  \
0                1       300x251  25640417   
1                1       300x250  53529977   
2                1       300x251  25640537   

                                                                                      custom_targeting  \
0  pos=wx_300var;preempt=y;age=nl;amznslots=nl;baro=stdy;cc=us;ch=pets;cnd=clr;cobr=nl;ct=burlingam...   
1  aid=9e2117943s7a0a4879r91878315mn23191r2;bn=n;cc=us;ch=nl;cnd=clr;ct=fair haven;dma=505;fam=nl;f...   
2  pos=wx_mid300;preempt=y;age=nl;amznslots=nl;baro=stdy;cc=us;ch=pets;cnd=rain;cobr=nl;ct=mt hood ...   

              domain country_id        country region_id      region metro_id                              metro  \
0        plsinfo.org       2840  United States     21137  California   200807  San Francisco-Oakland-San Jose CA   
1        comcast.net       2840  United States     21155    Michigan   200505                         Detroit MI   
2  bendbroadband.com       2840  United States     21170      Oregon   200821                            Bend OR   

   city_id           city postal_code_id postal_code browser_id                             browser   os_id  \
0  1014215      San Bruno        9031930       94066     500069                   Other Other.Other  501011   
1  1019480  New Baltimore        9016810       48047     500072                       Google Chrome  501013   
2  1024400           Bend        9033151       97701     500123  Microsoft Internet Explorer 11.Any  501011   

                    os   bandwidth bandwidth_id   time_usec    requested_adunit_sizes    product bandwidth_group_id  \
0  Microsoft Windows 7  adsl-8mbps       502017  1414392616  300x600|300x1050|300x251  Ad Server                  3   
1              Android        wifi       502012  1414392617           300x250|320x300  Ad Server                  6   
2  Microsoft Windows 7       cable       502002  1414392620           300x251|320x300  Ad Server                  4   

  iscompanion dfpfiledate  
0       False  2014-10-27  
1       False  2014-10-27  
2       False  2014-10-27   


small_targeting_tag:
=====================================
                 time                  userid       ip advertiser_id order_id lineitem_id creative_id  \
0 2014-12-10 02:51:09  NJxs0taF8_2kbj2AvlrdvA  0.0.0.0             0        0           0           0   
1 2014-12-10 02:51:09  jsug8yxlWG6oj5jb9AzW5A  0.0.0.0             0        0           0           0   
2 2014-12-10 02:51:09  jsug8yxlWG6oj5jb9AzW5A  0.0.0.0             0        0           0           0   

  creative_version creative_size adunit_id     custom_targeting       domain country_id        country region_id  \
0                0                40997777       atf=0;pos=null  comcast.net       2840  United States     21137   
1                0                38454257  atf=0;pos=wx_bot300       rr.com       2840  United States     21154   
2                0                38454257  atf=1;pos=wx_mid300       rr.com       2840  United States     21154   

       region metro_id                              metro  city_id               city postal_code_id postal_code  \
0  California   200807  San Francisco-Oakland-San Jose CA  1014243          San Ramon        9032044       94583   
1       Maine   200500                 Portland-Auburn ME  1018822  Cumberland Center        9002522       04021   
2       Maine   200500                 Portland-Auburn ME  1018822  Cumberland Center        9002522       04021   

  browser_id                             browser   os_id                   os     bandwidth bandwidth_id   time_usec  \
0     500104        Safari (iPhone/iPod) Any.Any  501012            Apple iOS          wifi       502012  1418197869   
1     500123  Microsoft Internet Explorer 11.Any  501026  Microsoft Windows 8  adsl2-12mbps       502018  1418197869   
2     500123  Microsoft Internet Explorer 11.Any  501026  Microsoft Windows 8  adsl2-12mbps       502018  1418197869   

  requested_adunit_sizes    product bandwidth_group_id iscompanion dfpfiledate  
0         300x251|320x51  Ad Server                  6       False  2014-12-10  
1         300x251|320x51  Ad Server                  3       False  2014-12-10  
2         300x251|320x51  Ad Server                  3       False  2014-12-10   


targeting_values:
=====================================
  targeting_value_id   name                display_name targeting_key_id match_type
0        36487095857  10043          HF-PET-ENTHUSIASTS           257417      EXACT
1        36487099697  70016       SYND-BUDGET CONSCIOUS           257417      EXACT
2        36487103537  70053  SYND-REAL EST&MORT SHOPPER           257417      EXACT 


lineitem_inventory_targeting:
=====================================
  lineitem_id adunit_id include include_descendants
0    74794337  25638977    True                True
1    75621377  25573937    True                True
2    77373137  25574057    True                True 


creatives:
=====================================
   creative_id                                                            name advertiser_id     creative_type  \
0  26505334337  5-T3_ELECTRONICS_BLURAY DVD HARDWARE_BLUERAY PLAYER_300x250_ME      16672337  TemplateCreative   
1  26551626257            25-T3_LADIES WEAR_PANTS ACTIVE_KNIT PANTS_300x250_ME      16672337  TemplateCreative   
2  26551626857          27-T6_BOYS WEAR_JEANS (D24)_CARPENTER JEANS_300x250_TX      16672337  TemplateCreative   

   last_modified_date  \
0 2013-09-07 11:14:36   
1 2013-09-10 09:15:45   
2 2013-09-10 09:29:04   

                                                                                           preview_url  height  width  
0  http://partner.googleadservices.com/gampad/ads?gct=FbT-hdnyo6YKlgH4DAH6Fo8BCAkQHyAASgBSFWZpbGU6L...     250    300  
1  http://partner.googleadservices.com/gampad/ads?gct=H1Y5LlsLCNYKmAH4DAH6FpEBCAkQHyAASgBSFWZpbGU6L...     250    300  
2  http://partner.googleadservices.com/gampad/ads?gct=0k1RbgJrbOQKmAH4DAH6FpEBCAkQHyAASgBSFWZpbGU6L...     250    300   


lineitem_creative_assoc:
=====================================
   creative_id line_item_id  status destination_url          start_date            end_date manual_rotation_weight  \
0  36188359097     79415177  ACTIVE                 2014-03-01 05:00:00                 NaT                   null   
1  38522368337     84934937  ACTIVE                 2014-04-02 19:13:00                 NaT                   null   
2  47085403697    101867777  ACTIVE                 2014-09-14 04:00:00 2014-09-21 03:59:00                   null   

  sequential_rotation_index creative_set_id  
0                      null            null  
1                      null            null  
2                      null            null   


lineitem_geo_targeting:
=====================================
  line_item_id location_type location included
0     90057977         Metro      512     True
1     90073937         Metro      567     True
2    125218577         Metro      820     True 


targeting_keys:
=====================================
  targeting_key_id name                     display_name        type
0           258737  fc2  Wx Trig Forecasted Conditions 2  PREDEFINED
1           260417  snw        Wx Trig Snow Accumulation  PREDEFINED
2           262337  ver                   Mobile Version  PREDEFINED 


adunit:
=====================================
  adunit_code        id last_modified_datetime       name parent_id partner_id
0   twclevel1  22841657    2012-06-12 14:09:06  twclevel1  22841537       null
1      hourly  25586897    2012-06-12 20:36:17     hourly  25576937       null
2      health  25609577    2012-06-13 16:16:39     health  25573577       null 


advertiser:
=====================================
  advertiser_id                           name  last_modified_date primary_contact_id address email comment  \
0      16675217               CLEVELAND CLINIC 2012-08-28 19:41:19               null                         
1      16683857                        LL BEAN 2012-08-28 21:34:19               null                         
2      16719497  FLORIDA TOURISM/VISIT FLORIDA 2012-08-31 20:33:37               null                         

  credit_status primary_phone fax_phone        type external_id third_party_id  
0        ACTIVE                          ADVERTISER                       null  
1        ACTIVE                          ADVERTISER                       null  
2        ACTIVE                          ADVERTISER                       null   


lineitems:
=====================================
    creation_datetime delivery_rate_type        end_datetime external_id        id is_missing_creatives  \
0 2013-09-05 15:19:22        FRONTLOADED 2013-11-25 04:59:59              64287977                False   
1 2013-09-05 16:01:40        FRONTLOADED 2013-11-25 04:59:59              64331897                False   
2 2013-09-05 16:23:45        FRONTLOADED 2013-11-25 04:59:59              64363937                False   

  last_modified_datetime line_item_type                                                                  name  \
0    2013-11-18 14:59:08       STANDARD          100139105-1_WEATHER_DMA-Detroit_Med Rect_WX TRIG ( 8-T4-On )   
1    2013-11-18 11:11:20       STANDARD  100134428-1_WEATHER_DMA-Minot Bismarck_Med Rect_WX TRIG ( 32-T1-On )   
2    2013-11-18 11:18:43       STANDARD  100134410-1_WEATHER_DMA-Minot Bismarck_Med Rect_WX TRIG ( 14-T1-On )   

    order_id      start_datetime     status  units_bought      budget cost_type  value_cost_per_unit  \
0  139870577 2013-09-09 04:00:00  COMPLETED        300000  4200000000       CPM                    0   
1  139875497 2013-09-09 04:00:00  COMPLETED        100000  1400000000       CPM                    0   
2  139875497 2013-09-09 04:00:00  COMPLETED        100000  1400000000       CPM                    0   

  value_cost_per_unit_currency  
0                          USD  
1                          USD  
2                          USD   


orders:
=====================================
    order_id                                                                                      name  \
0  137581217                                                             106022_KG_AUG_2013_SKNNOURISH   
1  150998177                                                    106654_Holland America - FY14 Tactical   
2  161571017  106914_P.F. Chang's China Bistro, Inc.-P.F. Chang's Winter Seasonal Menu-TWC-Interactive   

      start_date_time       end_date_time    status total_budget last_modified_datetime  
0 2013-09-01 04:00:00 2013-12-23 04:59:59  APPROVED  91052842000    2013-12-20 22:05:01  
1 2013-12-01 05:00:00 2014-06-01 03:59:59  APPROVED  30953489000    2014-05-27 22:04:13  
2 2014-01-28 05:00:00 2014-02-24 04:59:59  APPROVED  40799986000    2014-02-04 21:20:09