Skip to main content

sparktool

built to simplified the process of creating sparksession(hccn).

  • get saved query from hue
  • batch execute sqls
  • parse impala/hive view automatically
  • parse kudu table automatically

install

Python 2/3

  • pip install --user --upgrade sparktool
  • pip2 install --user --upgrade sparktool

functions

switch_keytab (first run)

import sparktool as st
st.switch_keytab('admin@EXAMPLE.COM', keytabpath)

switch_huetab (first run)

import sparktool as st
st.switch_huetab(username, password)

SparkCreator

[in]

import sparktool as st
ss = st.SparkCreator()
sql = '''
select 1;
select
    cc.skp_client
from
    owner_ogg.ft_ccase_2_ccase_ad cc
    join owner_ogg.clt_ccase_2_ccase_relation re
      on cc.skp_ccase_2_ccase_relation = re.skp_ccase_2_ccase_relation
     and re.code_ccase_relation = 'FIRST_POS' 
limit 1
;
'''
ss.batch_excutesql(sql)

[out]

Tranform Table:
+--------------------------------------+--------------------------------------+--------------+
|             Origin Table             |            Temporary View            | If Transform |
+--------------------------------------+--------------------------------------+--------------+
|    OWNER_OGG.FT_CCASE_2_CCASE_AD     |    owner_ogg_ft_ccase_2_ccase_ad     |     New      |
| OWNER_OGG.CLT_CCASE_2_CCASE_RELATION | owner_ogg_clt_ccase_2_ccase_relation |     New      |
+--------------------------------------+--------------------------------------+--------------+
Excute Progress: 2/2
DataFrame[skp_client: decimal(38,0)]

[param]

  • ifview: if view in sql, it will parse view to code
  • ifbatchre: b,c,d,e,f = ss.batch_excutesql(sql, ifview=True, ifbatchre=True)

HueCreator

[in]

from sparktool import HueCreator
aa = HueCreator()
aa.hue_printlist()

[out]

+--------+-------------------------+----------------------------+-------------------+
|   id   |           name          |        description         |   last_modified   |
+--------+-------------------------+----------------------------+-------------------+
| 691124 |     aaaaaaaaaaaaaaa     |                            | 2020-01-17T17:41Z |
| 686849 |           hcp           |                            | 2020-01-17T10:32Z |
| 675390 |           aaaa          |                            | 2020-01-16T11:05Z |
| 681235 |          ttttt          |                            | 2020-01-15T09:41Z |
| 676699 |           aaaa          |                            | 2020-01-14T09:53Z | |
+--------+-------------------------+----------------------------+-------------------+

[in]

aa.hue_getscript('hcp')

[param]

  • ifprint: print sql which is beautified

[in]

aa.hue_setscript(sql, name='hcp', uuid=None)

[param]

  • uuid > name

idea

https://github.com/renyumm/sparktool/blob/master/Sparkcreator.png

Release files for sparktool 3.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sparktool 3.1.4
File Size Uploaded
sparktool-3.1.4.tar.gz 10.5 kB Details

Release files / sparktool-3.1.4.tar.gz

Download URL sparktool-3.1.4.tar.gz
Size 10.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ac6b2023ffe4078e42fedfe78b56c322b725bf62984127db0cd42ee8e9d86bc4
BLAKE2b-256 checksum
How to use checksums
8920e161daf55dba4aea0294c85b96a3aa432e3279f1f8b8d53cbdc4211a9d70
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

Release history Release notifications | RSS feed

This release

3.1.4 This release

1 release file

3.1.3

1 release file

3.1.2

1 release file

3.1.1

1 release file

3.1.0

1 release file

3.0.9

1 release file

3.0.8

1 release file

3.0.7

1 release file

3.0.6

1 release file

3.0.5

1 release file

3.0.4

1 release file

3.0.3

1 release file

3.0.2

1 release file

3.0.1

1 release file

3.0.0

1 release file

2.0.5

1 release file

2.0.4

1 release file

2.0.3

1 release file

2.0.2

1 release file

2.0.1

1 release file

2.0.0

1 release file

1.0.2

1 release file

1.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page