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

Unable to upload files into the model_upload directory in PaoC #1123

Open
maniqn opened this issue May 29, 2024 · 1 comment
Open

Unable to upload files into the model_upload directory in PaoC #1123

maniqn opened this issue May 29, 2024 · 1 comment
Labels

Comments

@maniqn
Copy link

maniqn commented May 29, 2024

Hi,

Description
I'm facing issues with performing file uploads to the model_upload directory for an PaoC instance under the utilization of tm1.files.update_or_create function.
Although I'm able to upload a file to the super ordinate data directory, I cannot upload the same file to the subordinate model_upload directory.

Reproduction
I ran the following code snippet from my local machine.
The excluded TargetPath variables are exemplary for the different attempts i took to perform the file-upload to the model_upload directory instead of the data directory. (I have also tried various other combinations e.g.: "\", string concatenation etc.).

filename = "filexyz.csv"
SourcePath = filename
TargetPath = filename
#TargetPath = f"model_upload/{filename}"
#TargetPath = f"D:/prod/tm1/Data/model_upload/{filename}"

# Connect to the TM1 instance
with TM1Service(
    base_url='',
    user="",
    namespace="",
    password="",
    ssl=True,
    verify=True,
    async_requests_mode=True) as tm1:
    with open(SourcePath, "rb") as file:
        tm1.files.update_or_create(file_name=TargetPath, file_content=file.read())

While there is no prefix to reference the desired target directory (as shown in current TargetPath variable above) the upload is performed directly in the data directory.
When I execute the code and reference an explicit directory (e.g. commented out TargetPath variables above) I get the following error message and the upload is not executed.

Something else went wrong. Check error code: Text: '{"error":{"code":"278","message":"Only Document entries may be created in the Contents('Blobs')/Contents collection."}}' - Status Code: 400 - Reason: 'Bad Request' - Headers: {'Content-Length': '124', 'Connection': 'keep-alive', 'Content-Encoding': 'gzip', 'Cache-Control': 'no-cache', 'Content-Type': 'application/json; charset=utf-8', 'OData-Version': '4.0'}

Expectation
My expectation would be that the file upload for a specific directory (e.g. model_upload) would work in the same way as for an unspecified directory (data).

Version
Python 3.11.4
TM1py 2.0.3
TM1 Server Version 11.8.02200.2
PAW Version 2.0.96

Any ideas what I am doing wrong, or what could be the reason?

@maniqn maniqn added the bug label May 29, 2024
@onefloid
Copy link
Contributor

onefloid commented Oct 6, 2024

Hi @maniqn, it looks like folders are only supported from TM1 Server Version 12.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants