Global Table cannot be replaced

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 10
Accepted Solution

Global Table cannot be replaced

Hi,

 

I was trying to replace the csv file in the cas server using python-swat interface. However, I encounter error with "Global Table cannot be replaced" when I run it.

 

 

Below is the code I used to upload the data. Anyone know the reason behind it? Thank you

 

conn.upload('abc.csv',casout=dict(name='trialupload2',caslib='public',promote = 'true',replace = 'true'))

 

TRIALUPLOAD2 table is in my cas server, and when I try to replace it, it resulted in the above error.


Accepted Solutions
Solution
‎03-20-2018 01:04 AM
SAS Super FREQ
Posts: 821

Re: Global Table cannot be replaced

Try dropping the table first using the dropTable action

View solution in original post


All Replies
SAS Employee
Posts: 524

Re: Global Table cannot be replaced

@Zhteh,

ERROR: Global tables cannot be replaced.

 

This is a valid error because "promote" and "replace" cannot be used together.

Occasional Contributor
Posts: 10

Re: Global Table cannot be replaced

 

Hi @alexal,

 

If that is the case, then may I know is there any workaround for this? because I wish to overwrite the existing data in the CAS server. And if I set the promote to false, the data uploaded won't be visible to me anymore. 

SAS Employee
Posts: 524

Re: Global Table cannot be replaced

@Zhteh,

 

Upload the data to your session scope, then promote to the global scope (in a separate action).

Occasional Contributor
Posts: 10

Re: Global Table cannot be replaced

@alexal

 

May I know the proper way of promoting to global scope? Now that with

conn.read_csv('abc.csv',casout=dict(name='trialupload123',caslib='public',replace ='true'))

thiis command I am able to upload to the session scope.

 

But using when trying to promote to global scope using the below command it fails.
conn.read_csv('abc.csv',casout=dict(name='trialupload123',caslib='public',promote = 'true'))

SAS Employee
Posts: 524

Re: Global Table cannot be replaced

@Zhteh,

 

Something like that:

 

load_csv = conn.read_csv('https://raw.githubusercontent.com/sassoftware/sas-viya-programming/master/data/cars.csv',casout=dict(name='CARS',caslib='CASUSER',replace ='true'))
promote_csv = conn.promote(load_csv,target='NEW_NAME_FOR_CARS_TABLE')
Occasional Contributor
Posts: 10

Re: Global Table cannot be replaced

@alexal

 

Thanks for the code. However, there is still one problem here. The error exists because the target table of the promotion already exists. Means  that I couldn't overwrite the table of the same name in the CAS server.

 

ERROR: The target table trialupload432 of the promotion already exists. Please specify a different name.
SAS Employee
Posts: 524

Re: Global Table cannot be replaced

@Zhteh,

 

That's correct. You have to choose a new name like I showed above.

Occasional Contributor
Posts: 10

Re: Global Table cannot be replaced

thanks for the solution. However, the problem is that the table name in the global scope will be different everytime I upload the data. And in the SAS Studio I will have to access data from different tables every time. 

Solution
‎03-20-2018 01:04 AM
SAS Super FREQ
Posts: 821

Re: Global Table cannot be replaced

Try dropping the table first using the dropTable action

Occasional Contributor
Posts: 10

Re: Global Table cannot be replaced

Posted in reply to Bruno_SAS

@Bruno_SAS

Thanks. That will do the trick 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 10 replies
  • 309 views
  • 0 likes
  • 3 in conversation