Skip to content

Create table with schema detects field names as tables #168

@YoannQDQ

Description

@YoannQDQ

When creating a fully qualified table (with explicit schema), field names are recognized as tables.

from sql-metadata import Parser

SQL = """
CREATE TABLE mytable (
    code INTEGER NOT NULL,
    short_name CHAR(9)
);
"""
SQL2 = """
CREATE TABLE myschema.mytable (
    code INTEGER NOT NULL,
    short_name CHAR(9)
);
"""

Result

>>> Parser(SQL).tables
['mytable']

>>> Parser(SQL2).tables
['myschema.mytable', 'code', 'short_name']

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions