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

How to get rid of the warning #1336

Closed
djouallah opened this issue Nov 18, 2024 · 8 comments · Fixed by #1346
Closed

How to get rid of the warning #1336

djouallah opened this issue Nov 18, 2024 · 8 comments · Fixed by #1346

Comments

@djouallah
Copy link

Question

using this code with pyiceberg 0.8

tbl = db+"."+"calendar"
if not catalog.table_exists(tbl):
  df=duckdb.sql(""" SELECT cast(unnest(generate_series(cast ('2018-04-01' as date), cast('2024-12-31' as date), interval 1 day)) as date) as date,
            EXTRACT(year from date) as year,
            EXTRACT(month from date) as month
            """).arrow()
  catalog.create_table_if_not_exists(tbl,schema=df.schema)
  catalog.load_table(tbl).overwrite(df)
  print('calendar created')
else:
    print("table exist already")

I am getting this warning, how I can remove it

/usr/local/lib/python3.10/dist-packages/pyiceberg/utils/deprecated.py:54: DeprecationWarning: Deprecated in 0.8.0, will be removed in 0.9.0. Table.identifier property is deprecated. Please use Table.name() function instead.
  _deprecation_warning(deprecation_notice(deprecated_in, removed_in, help_message))
/usr/local/lib/python3.10/dist-packages/pyiceberg/utils/deprecated.py:54: DeprecationWarning: Deprecated in 0.8.0, will be removed in 0.9.0. Support for parsing catalog level identifier in Catalog identifiers is deprecated. Please refer to the table using only its namespace and its table name.
  _deprecation_warning(deprecation_notice(deprecated_in, removed_in, help_message))
calendar created
@kevinjqliu kevinjqliu added this to the PyIceberg 0.8.1 release milestone Nov 19, 2024
@kevinjqliu
Copy link
Contributor

Thanks for reporting this! This is a bug where the warning is emitted when the catalog identifier is not used.

@kevinjqliu
Copy link
Contributor

Possibly related to #1318, but i'll double check

@Fokko
Copy link
Contributor

Fokko commented Nov 19, 2024

Looping in @sungwy here, did you mean to return self._identifier here?

def name(self) -> Identifier:
"""Return the identifier of this table.
Returns:
An Identifier tuple of the table name
"""
return self.identifier

@sungwy
Copy link
Collaborator

sungwy commented Nov 20, 2024

Hi @Fokko, @djouallah thanks for flagging this! I think I must have missed out on updating the name method in this large deprecation exercise: https://github.com/apache/iceberg-python/pull/994/files#diff-23e8153e0fd497a9212215bd2067068f3b56fa071770c7ef326db3d3d03cee9bR1441-R1443

It also looks like .name() method is only called within the Table class's __eq__ method, so it's not obvious to me where in @djouallah code snippet this method is being called. A follow up question on my side to help with the root cause investigation @djouallah - what catalog type are you using in your example above?

@djouallah
Copy link
Author

polaris

@kevinjqliu
Copy link
Contributor

The first warning, Table.identifier property is deprecated. Please use Table.name() function instead. is from the use of Table.identifier used by the pyiceberg codebase.
See https://grep.app/search?q=.identifier&words=true&filter[repo][0]=apache/iceberg-python

The second warning, Support for parsing catalog level identifier in Catalog identifiers is deprecated., is addressed by #1326

@kevinjqliu
Copy link
Contributor

Opened #1346 as a fix

@kevinjqliu
Copy link
Contributor

Merged #1346, will try to get 0.8.1 out ASAP with this fix

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

Successfully merging a pull request may close this issue.

4 participants