Curts0 / PyTabular

Connect to Tabular Models via Python
https://curts0.github.io/PyTabular/
MIT License
67 stars 11 forks source link

Refresh the Model #91

Closed Daandamhuis closed 1 year ago

Daandamhuis commented 1 year ago

Hi,

Is there a way to first process Data Only and the Calculate?

import pytabular
model = pytabular.Tabular(CONNECTION_STR)
tables = model.Tables
if len(tables) > 0:
    tables.refresh(RefreshType.DataOnly)

model.refresh(RefreshType.Calculate)
Curts0 commented 1 year ago

Hey @Daandamhuis not right now but would be an easy addition. I can probably get to it this weekend. Would be a good addition. Unless you already started with this? Sorry for the very delayed reply!

Can have a keyword arg that defaults to full but let's any of the refresh types get passed

Curts0 commented 1 year ago

@Daandamhuis I lied lol. Turns out you can do it and I didn't know I built it that way.

import pytabular
from pytabular.refresh import RefreshType
model = pyatbular.Tabular(CONNECTION_STR)
if len(tables) > 0:
    tables.refresh(refresh_type=RefreshType.DataOnly)

model.refresh(refresh_type=RefreshType.Calculate)

I import RefreshType in the refresh file.

The main PyRefresh class has the parameter refresh_type. So just pass the RefreshType you want in your refresh and you should be good to do.

Daandamhuis commented 1 year ago

Ahh that's cool! I'll see if I can get it working 😀