Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI to Compare and Apply Configs, Base Datasource Feature Additions #92

Draft
wants to merge 27 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
aaf7a63
add where functions go
jaybythebay May 31, 2024
6478902
bump version to include in 2.2.12
jaybythebay Jun 2, 2024
1645ec2
removing empty folder works
jaybythebay Jun 2, 2024
d1f664d
mock test works
jaybythebay Jun 2, 2024
8de989c
3 tests passed
jaybythebay Jun 2, 2024
a747c19
rename
jaybythebay Jun 2, 2024
de1ade3
rename
jaybythebay Jun 2, 2024
803aeed
add new testing to the ci
jaybythebay Jun 2, 2024
acc1d27
move generate config dics to their own function to make it resuavble
jaybythebay Jun 2, 2024
20daaf7
add comments and delete duplicate code
jaybythebay Jun 2, 2024
292546c
getting args validation error as expected
jaybythebay Jun 2, 2024
57e63a8
wip
jaybythebay Jun 2, 2024
835402b
Move column_init to finction
jaybythebay Jun 3, 2024
71559be
clean comments and docs
jaybythebay Jun 3, 2024
0924b79
define color and symbols as globals so it will all work in functions
jaybythebay Jun 3, 2024
1b774f9
define color and symbols as globals so it will all work in functions …
jaybythebay Jun 3, 2024
ccb8c59
more code
jaybythebay Jun 4, 2024
779781d
Clean naming
jaybythebay Jun 4, 2024
10921fe
Add lots of stuff
jaybythebay Jun 4, 2024
9c2c5cc
passing tests and printing the number of tests to console
jaybythebay Jun 4, 2024
04ffd52
works with typing
jaybythebay Jun 4, 2024
0582861
invert configs working with typing
jaybythebay Jun 4, 2024
5f56687
invert configs working with typing
jaybythebay Jun 4, 2024
30cb25e
invert configs working with typing
jaybythebay Jun 4, 2024
f49bc3e
still getting attribute errors:
jaybythebay Jun 4, 2024
856aba0
ignoring getting that test to work for now
jaybythebay Jun 4, 2024
ebd6e96
WIP
jaybythebay Jun 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
define color and symbols as globals so it will all work in functions
  • Loading branch information
jaybythebay committed Jun 3, 2024
commit 0924b79f77017eb5d49a34b4289654e9bfd31b5d
24 changes: 24 additions & 0 deletions tableau_utilities/scripts/apply_configs.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
from copy import deepcopy

from tableau_utilities.scripts.gen_config import build_configs

def invert_config(config):
""" Helper function to invert the column config and calc config.
Output -> {datasource: {column: info}}

Args:
iterator (dict): The iterator to append invert data to.
config (dict): The config to invert.
"""

temp_config = {}

for column, i in config.items():
for datasource in i['datasources']:
new_info = deepcopy(i)
del new_info['datasources']
new_info['local-name'] = datasource['local-name']
new_info['remote_name'] = datasource['sql_alias'] if 'sql_alias' in datasource else None
iterator.setdefault(datasource['name'], {column: new_info})
iterator[datasource['name']].setdefault(column, new_info)

def combine_configs():
pass

def compare_configs(config, datasource_cureent_config, datasource_name):
""" Compares the config to a datasource. Generates a list of changes to make the datasource match the config
Expand Down
7 changes: 4 additions & 3 deletions tableau_utilities/scripts/datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
from tableau_utilities.tableau_server.tableau_server import TableauServer


# Define color and symbol as globals
color = Color()
symbol = Symbol()

def create_column(name: str, persona: dict):
""" Creates the tfo column object with the minimum required fields to add a column

Expand Down Expand Up @@ -145,9 +149,6 @@ def datasource(args, server=None):
conn_schema = args.conn_schema
conn_warehouse = args.conn_warehouse

# Print Styling
color = Color()
symbol = Symbol()

# Downloads the datasource from Tableau Server if the datasource is not local
if location == 'online':
Expand Down